Welcome! Log In Create A New Profile

Advanced

Nginx / FastCGI crashing on me all the time

Posted by rposky 
Nginx / FastCGI crashing on me all the time
January 12, 2012 03:12PM
Are there any Nginx / FastCGI gurus out there who can help me?

I'm running nginx 1.0.11 on Debian Squeeze serving Mono FastCGI (fastcgi-mono-server4 2.10.2.0). I am noticing that the FastCGI instances frequently crash in response to POST requests in excess of ~350,000 bytes. Though some requests of this magnitude are successful, they are more likely to fail with increased traffic. Additionally, oftentimes when a FastCGI instance fails, an Nginx worker process will be zombified (i.e. Nginx still handles requests but times out - no 502s are returned although all gateways may be down). I turned Nginx debugging on and noticed the following before a worker process and FastCGI instance crashed.

2012/01/11 20:38:42 [debug] 1744#0: *141 writev: 8
2012/01/11 20:38:42 [debug] 1744#0: *141 sendfile: @360448 32768
2012/01/11 20:38:42 [debug] 1744#0: *141 sendfile: 32768, @360448 32768:32768
2012/01/11 20:38:42 [debug] 1744#0: *141 writev: 8
2012/01/11 20:38:42 [debug] 1744#0: *141 sendfile: @393216 12167
2012/01/11 20:38:42 [debug] 1744#0: *141 sendfile: 12167, @393216 12167:12167
2012/01/11 20:38:42 [debug] 1744#0: *141 writev: 9
2012/01/11 20:38:42 [debug] 1744#0: *141 chain writer out: 0000000000000000
2012/01/11 20:38:42 [debug] 1744#0: *141 event timer del: 16: 1326314382071
2012/01/11 20:38:42 [debug] 1744#0: *141 event timer add: 16: 60000:1326314382072

These are just the last 10 items logged, but, if you'd like to see more, I can certainly post or PM. And lastly, here is my Nginx config file.

user www-data;
worker_processes 2;
worker_rlimit_nofile 8192;
events {
worker_connections 2048;
use epoll;
}

http {
error_log /var/log/error.log;
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;

gzip on;
gzip_http_version 1.1;
gzip_vary on;
gzip_comp_level 6;
gzip_proxied any;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript text/x-js font/opentype application/font-woff;
gzip_buffers 16 8k;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";

upstream backend {
server 127.0.0.1:8080;
server 127.0.0.1:8081;
}

server {
listen 80;
server_name my_server;
root /var/www;
access_log /var/log/host.access.log;

location / {
fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
include fastcgi_params;
fastcgi_pass backend;
fastcgi_next_upstream http_500 http_404 error timeout;
fastcgi_read_timeout 60;
}

location ~* ^.+\.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|pdf|txt|tar|wav|bmp|rtf|js|flv|swf|html|htm)$ {
root /var/www;
}
}
}

Posted to StackOverflow at http://stackoverflow.com/posts/8828734/edit
Re: Nginx / FastCGI crashing on me all the time
January 12, 2012 04:34PM
Oops, http://stackoverflow.com/questions/8828734/nginx-fastcgi-crashing-on-me-all-the-time is the proper link.
Re: Nginx / FastCGI crashing on me all the time
February 20, 2012 10:40PM
Since you're on Linux, you might try to disable sendfile support in the first place:

directio 512;
sendfile off;
tcp_nopush on;
tcp_nodelay on;

and see if it changes anything.

Andrejs
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 135
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready