[Solved]-Nginx + fastcgi truncation problem

8👍

I had the same exact problem running Nagios on nginx. I stumbled upon your question while googling for an answer, and reading “permission denied” related answers it struck me (and perhaps it will help you) :

  • Nginx error.log was reporting :

    2011/03/07 11:36:02 [crit] 30977#0: *225952 open() “/var/lib/nginx/fastcgi/2/65/0000002652” failed (13: Permission denied)

  • so I just ran # chown -R www-data:www-data /var/lib/nginx/fastcgi

  • Fixed ! (and thank you for your indirect help)

👤Falken

6👍

Check your error logs for “Permission denied” errors writing to .../nginx/tmp/... files. Nginx will work fine unless it needs temporary space, and that typically happens at 32K boundaries. If you find these errors, make sure the tmp directory is writable by the user nginx runs as.

👤dwc

3👍

What fastcgi interface are you using and how. Is it flup? If yes, paste the way you spawn the server and how it’s hooked into nginx. Without that information it’s just guessing what could go wrong.

Possible problems:

  • nginx is buggy. At least lighttpd has horrible fastcgi bugs, I wouldn’t wonder if nginx has some too 🙂
  • Django is dying with a traceback in an internal system that is not properly catched and closes the fastcgi server which you can’t see from the client. In that situation wrap the fastcgi server application call and try/except it to print the exception.

But server log and config would be great.

2👍

try to raise “gzip_buffers” may help.

see here:
http://blog.leetsoft.com/2007/7/25/nginx-gzip-ssl

👤Justin

2👍

FastCGI is not to blame for this.

I ran into exactly the same issue using nginx/gunicorn. Reducing the response size to less than 32k (in the specific case using the spaceless tag in the template) solved it.

As dwc says, it’s probably a hard limit due to the way nginx uses address space.

0👍

I’m running very similar configurations to this both on my webhost (Webfaction) and on a local Ubuntu dev server and I don’t see any problems. I’m guessing it’s a time-out or full buffer that’s causing this.

Can you post the output of the nginx error log? Also what version of nginx are you using?

As a side note it may be worth looking at django-logging to find out what your fastcgi process is doing.

Leave a comment