Welcome! Log In Create A New Profile

Advanced

Re: [crit] 16665#0 unlink()

May 04, 2013 07:10PM
On 05/03/13 18:01, Maxim Dounin wrote:
> Hello!
>

>
> You've configured two distinct caches to use single directory.
> This is not how it's expected to work.
>
> You should use distinct directories for each cache you configure.
> If you want different locations to use the same cache - just use
> the same cache in the proxy_cache directive.
>
> [...]
>
>> Is this bad practice to share caches among subdomains? Is sharing the cache
>> the reason why I'm getting unlink() errors?
>
> It's ok to use the same cache for different locations/servers.
> But it's really bad idea to configure multiple caches in the same
> directory, and this is what causes your problems.
>

Maxim,

I have just seen a similar situation using fastcgi cache. In my case I
am using the same cache (but only one cache) for several server/location
blocks. The system is a fairly basic nginx set up with four upstream
fastcgi servers and ip hash. The returned content is cached locally by
nginx. The cache is rather large but I wouldn't think this would be the
cause.

Relevant config:

http {

....

upstream fastcgi_backend {
ip_hash;
server 10.0.2.1:xxxx;
server 10.0.2.2:xxxx;
server 10.0.2.3:xxxx;
server 10.0.2.4:xxxx;
keepalive 8;
}

fastcgi_cache_path /var/nginx/fcgi_cache levels=1:2
keys_zone=one:512m max_size=250g inactive=24h;

....
}

server1 {
....

server_name domain1.com;

....

location ~ \.blah$ {
fastcgi_pass fastcgi_backend;
include /usr/local/etc/nginx/fastcgi_params;
fastcgi_buffers 64 4k;
fastcgi_read_timeout 120s;
fastcgi_keep_conn on;
fastcgi_send_timeout 120s;
fastcgi_cache one;
fastcgi_cache_key $scheme$request_method$host$request_uri;
fastcgi_cache_lock on;
fastcgi_cache_lock_timeout 5s;
fastcgi_cache_methods GET HEAD;
fastcgi_cache_min_uses 1;
fastcgi_cache_use_stale error updating;
fastcgi_cache_valid 200 302 60m;
fastcgi_cache_valid 301 12h;
fastcgi_cache_valid 404 5m;
}

....

}

The other sever/location blocks are pretty much identical insofar as
fastcgi and cache are concerned.

When I upgraded nginx using the "on the fly" binary upgrade method, I
saw almost 400,000 lines in the error log that looked like this:

2013/05/04 17:54:25 [crit] 65304#0: unlink()
"/var/nginx/fcgi_cache/7/2e/899bc269a74afe6e0ad574eacde4e2e7" failed (2:
No such file or directory)
2013/05/04 17:54:25 [crit] 65304#0: unlink()
"/var/nginx/fcgi_cache/7/2e/42adc8a0136048b940c6fcaa76abf2e7" failed (2:
No such file or directory)
2013/05/04 17:54:25 [crit] 65304#0: unlink()
"/var/nginx/fcgi_cache/7/2e/c3656dff5aa91af1a44bd0157045d2e7" failed (2:
No such file or directory)
2013/05/04 17:54:25 [crit] 65304#0: unlink()
"/var/nginx/fcgi_cache/7/2e/de75207502d7892cf377a3113ea552e7" failed (2:
No such file or directory)
2013/05/04 17:54:25 [crit] 65304#0: unlink()
"/var/nginx/fcgi_cache/7/2e/c2205e6a3df4f29eb2a568e435b2b2e7" failed (2:
No such file or directory)
2013/05/04 17:54:25 [crit] 65304#0: unlink()
"/var/nginx/fcgi_cache/7/2e/6ccaa4244645e508dad3d14ff73ea2e7" failed (2:
No such file or directory)
2013/05/04 17:54:25 [crit] 65304#0: unlink()
"/var/nginx/fcgi_cache/7/2e/76b4b811553756a2989ae40da863d2e7" failed (2:
No such file or directory)
2013/05/04 17:54:25 [crit] 65304#0: unlink()
"/var/nginx/fcgi_cache/7/2e/53d40a6399ba6dcf08bc0a52623932e7" failed (2:
No such file or directory)
2013/05/04 17:54:25 [crit] 65304#0: unlink()
"/var/nginx/fcgi_cache/7/2e/68ff8b00492991a2e3ba5ad7420d42e7" failed (2:
No such file or directory)
2013/05/04 17:54:25 [crit] 65304#0: unlink()
"/var/nginx/fcgi_cache/7/2e/19c079c9a1e0bcacb697af123d47f2e7" failed (2:
No such file or directory)

The backend logs show nothing of note.

--
Jim Ohlstein

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

[crit] 16665#0 unlink()

nano May 03, 2013 04:17PM

Re: [crit] 16665#0 unlink()

Maxim Dounin May 03, 2013 06:02PM

Re: [crit] 16665#0 unlink()

nano May 03, 2013 07:49PM

Re: [crit] 16665#0 unlink()

Jim Ohlstein May 04, 2013 07:10PM

Re: [crit] 16665#0 unlink()

Maxim Dounin May 05, 2013 04:34PM

Re: [crit] 16665#0 unlink()

Jim Ohlstein May 06, 2013 09:04AM

Re: [crit] 16665#0 unlink()

Maxim Dounin May 06, 2013 09:56AM

Re: [crit] 16665#0 unlink()

Jim Ohlstein May 06, 2013 10:22AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 67
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready