Upstrea/ Keepalive strange behaviour

Hello all,

I have a strange behavior when using upstream/keepalive and it could be
fine if someone can give me some feedback regarding this setup.

I have multiple locations with proxy_pass directive, i use
proxy_http_version 1.1 and “Connection” header is cleared.
In the upstream block, i have 2 or more upstream IP and i have add the
directive keepalive.

Now, sometimes i see this error log : “upstream prematurely closed
connection while reading response header from upstream”.

A tcpdump show that nginx send a GET to his upstream but the TCP
connection is closed and nginx don’t receive the response from
upstream. Most of the time, nginx uses another upstream server and the
transaction is successfully completed.
This behavior appears with different upstream server.

If someone has experiencing this kind of issue, feedback are welcome !

Thanks,
BR.


David Donchez - Lead Engineer, Research & Engineering
SmartJog | T: +33 1 5868 6190
27 Blvd Hippolyte Marquès, 94200 Ivry-sur-Seine, France
www.smartjog.com | a TDF Group company

Hello!

On Mon, Dec 09, 2013 at 04:52:11PM +0000, David DONCHEZ wrote:

Now, sometimes i see this error log : “upstream prematurely closed
connection while reading response header from upstream”.

A tcpdump show that nginx send a GET to his upstream but the TCP
connection is closed and nginx don’t receive the response from
upstream. Most of the time, nginx uses another upstream server and the
transaction is successfully completed.
This behavior appears with different upstream server.

As per HTTP specification, persistent connection can be closed by
the server at any time, and clients should handle this. That is,
that’s more or less normal, and nginx is expected to handle this
fine by using another upstream server if this happens.


Maxim D.
http://nginx.org/

Hello Maxim,

As per HTTP specification, persistent connection can be closed by
the server at any time, and clients should handle this. That is,
that’s more or less normal, and nginx is expected to handle this
fine by using another upstream server if this happens.

Thanks for your reply. I suspected that this behavior was normal but
it’s good to have a confirmation from your side.


David Donchez - Lead Engineer, Research & Engineering
SmartJog | T: +33 1 5868 6190
27 Blvd Hippolyte Marquès, 94200 Ivry-sur-Seine, France
www.smartjog.com | a TDF Group company