How does nginx know about FastCGI's stderr?

Maxim Dounin mdounin at mdounin.ru
Mon Mar 15 16:15:25 MSK 2010


Hello!

On Mon, Mar 15, 2010 at 08:56:11PM +0800, 任晓磊 wrote:

> On Mon, Mar 15, 2010 at 5:49 PM, Maxim Dounin <mdounin at mdounin.ru> wrote:
> > http://www.fastcgi.com/devkit/doc/fcgi-spec.html
> Thank you, Maxim. The document above tells me the detail. I thought
> the protocol is a couple of stdio pipes before read this.
> 
> So, could you tell me why I see 502 when something in FastCGI's
> stderr? Does texts from FastCGI's stderr lead to 502 ? But the specs
> says they're just application-level errors.

Writing to stderr shouldn't lead to 502 from nginx.  This may 
happen in two cases:

1) Application actually dies (or aborts request) after writing to 
stderr.

2) Bug in nginx.  There is one known bug with fastcgi_cache and 
large stderr from fastcgi apps which may lead to 502 returned 
unexpectedly.  It's mostly fixed in 0.8.34, though fix may lead to 
segfaults in nginx worker when fastcgi_cache isn't used, patch is 
here:

http://nginx.org/pipermail/nginx-ru/2010-March/032836.html

Maxim Dounin



More information about the nginx mailing list