I'm experiencing a really weird issue where nginx is leaking memory up until the point where it consumes all available memory on the machine and stops responding to HTTP requests.

The machine has 2GB of RAM and it only takes a few minutes for nginx to consume it all. I've also noticed the /var/cache/nginx/tmp directory ballooning in size in line with the memory usage.

My config file includes the following. Please let me know if I need to post more information.

proxy_cache_path /var/cache/nginx/files levels=1:2 keys_zone=files:100m inactive=12h max_size=100m;
proxy_cache_path /var/cache/nginx/cdn levels=1:2 keys_zone=cdn:100m inactive=12h max_size=100m;
proxy_temp_path /var/cache/nginx/tmp;

# in a location block:
proxy_pass http://some.upstream.server/;
proxy_cache files;
proxy_cache_valid 200 302 24h;
proxy_cache_valid 404 30s;
proxy_intercept_errors on;

The server is running Ubuntu Server 11.04, with nginx 1.0.5 compiled from source.

link|improve this question

25% accept rate
1  
I've used almost all nginx versions starting from 0.6.x branch and never saw nginx leaking. Do you use any (non-standard) nginx modules?.. they can be a real reason, try to exclude them. Second, describe your problem at nginx mailing list mailman.nginx.org/mailman/listinfo/nginx and ask nginx developers for help. They will want to see your configuration and "debug" log, so prepare it beforehand. – Alexander Azarov Aug 8 '11 at 9:00
Ah, forgot to say I have an in-house CDN built with Nginx's proxy_cache and it works perfectly for some years already. – Alexander Azarov Aug 8 '11 at 9:01
@Alexander: My nginx is just stock 1.0.5. I'm running a home-made CDN too, and I'm only experiencing this issue on the one server. The rest are fine. It's really peculiar. – Charlie Somerville Aug 9 '11 at 3:26
Then you'd better describe this problem to the developers indeed. – Alexander Azarov Aug 9 '11 at 6:59
feedback

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
or
required, but never shown

Browse other questions tagged or ask your own question.