md5 fastcgi cache collisions

Maxim Dounin mdounin at
Tue Sep 25 00:27:00 UTC 2012


On Sat, Sep 22, 2012 at 04:39:47PM -0400, Ian M. Evans wrote:

> Was looking at my error log and noticed a whole bunch of errors like this:
> 2012/09/22 15:52:26 [crit] 641#0: *4896016 cache file
> "/var/lib/nginx/fastcgicache/3/21/32d5a44032aadeeed2b1d027314ba213" has
> md5 collision, client: x.x.x.x, server:, request: "GET
> /cr/denzelwashington/ HTTP/1.1", host: ""

Is the file reported is the same in all errors?

> My fastcgi cache is setup as follows:
> fastcgi_cache_path /var/lib/nginx/fastcgicache levels=1:2
> keys_zone=MYCACHE:5m inactive=2h max_size=1g loader_files=1000
> loader_threshold=2000;
> map $http_cookie $no_cache { default 0; ~SESS 1; }
> fastcgi_cache_key "$scheme$request_method$host$request_uri";
> add_header X-My-Cache $upstream_cache_status;
> /cr is actually a php file called like this in the nginx.conf from a
> thread years ago:
> location ~ ^/cr(/.*$|$) {
> rewrite ^/cr(/.*$|$) /$1.php?mypath=$2 last;
> }
> Site's working fine...just wondering what's causing all the collisions.

Most likely it's a corrupted cache file.  Looking into the cache 
file should be enough to see if it's indeed corrupted.

Intresting question is to find out how the file was corrupted.  
This may be either something "normal" like filesystem corruption 
after power failure, or something in nginx.  The later case might 
need investigation.

If you just want to get rid of the messages you may try to remove 
the cache file, it should fix things.  Normal nginx behaviour is 
to replace such currupted cache files with new responses, but it 
looks like it doesn't work in your case, likely because responses 
aren't cacheable.

Maxim Dounin

More information about the nginx mailing list