cache file has too long header (bug) ?

Maxim Dounin mdounin at
Thu Sep 10 18:18:31 UTC 2015


On Thu, Sep 10, 2015 at 01:30:46PM -0400, biazus wrote:

> Hey Guys,
> I've been using nginx 1.8.0 for a couple of months, and I noticed a critical
> message at error log informing that "cache file has too long header". 
> 2015/09/10 17:11:03 [crit] 27245#0: *10686 cache file
> "/data/smallfiles/http/6/d8/f5df8d6eda60819319688d1bc0cb2d86" has too long
> header
> However, as you can see at the example bellow, there is nothing abnormal
> with the file:
> cat /data/smallfiles/http/6/d8/f5df8d6eda60819319688d1bc0cb2d86


The message is logged when nginx detects the problem, ignores the 
cached file and starts loading another response from an upstream 
server.  So, unfortunately, as long as the message appeared, it's 
probably too late to look into the file as it's likely already 
reloaded from a backend.

The message itself is expected to appear if a response header 
stored in the cache file is too big for configured 
proxy_buffer_size.  It may also appear due to a small race 
condition in nginx cache logic if two different responses are 
loaded into cache simultaneously, see here:

The message may also indicates that the cache file was corrupted 

If you see the message on a regular basis, we may want to 
investigate further.  If it's just a single case in couple of 
months, it is probably due to the race condition in question and 
likely can be ignored safely.

Maxim Dounin

More information about the nginx mailing list