How does nginx know about FastCGI's stderr?

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


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

> On Mon, Mar 15, 2010 at 5:49 PM, Maxim Dounin <mdounin at> wrote:
> >
> 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 

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 

Maxim Dounin

More information about the nginx mailing list