Fastcgi_cache sometimes returns statuscode 500

Maxim Dounin mdounin at mdounin.ru
Mon Mar 2 15:03:34 UTC 2015


Hello!

On Mon, Mar 02, 2015 at 09:11:11AM -0500, mastercan wrote:

> I've had 2 cases with status code 500 now since setting error log to debug
> level:
> 
> The error msg: "epoll_wait() reported that client prematurely closed
> connection while sending request to upstream"

It's expected to be 499, not 500.  If it's 500, it problably means 
that there is some invalid error_page handling configured.

> It's interesting to note that:
> If a "normal" file (no caching involved) is requested and the client closes
> the connection prematurely, the status code is 200 and the response body is
> 0 bytes.
> If first a php script is called, which responds with a X-Accel-Redirect to
> the cached file, and the client closes the connection prematurely, the
> status code is 500 and the response body is 0 bytes.

When talking to upstream servers, nginx tries to detect if a 
client closed connection.  If it does so, nginx terminates request 
processing with the 499 status code.  The 
fastcgi_ignore_client_abort directive can be used to control the 
behaviour in case of the fastcgi module, see 
http://nginx.org/r/fastcgi_ignore_client_abort for details.

-- 
Maxim Dounin
http://nginx.org/



More information about the nginx mailing list