Nginx uwsgi connection timeout

Hello,

I have nginx 1.6.1 setup in front of uwsgi 2.0.7 using uwsgi_pass, which
has
been working very well for me except for one request. When I make the
failing request uwsgi processes the request and returns the response in
less
than a second, but nginx just sits there with an open connection to
uwsgi
eventually timing out after 60 seconds as if uwsgi did not send back a
complete request. I have many other pages hosted on this server all of
which work just fine, both post and get requests. The one difference I
have
noticed about this request is that the response is very small, 14 bytes
of
json. I have tried using both chunked and not chunked (with
content-length
header) encoding, they both yield the same result. I tried adding
“uwsgi_buffering off;” to my configuration, this allowed the request to
complete, but the next request hangs because nginx doesn’t think the
previous request is finished and I only have one uwsgi worker.

Does anyone have any ideas about what could cause this?

Thanks for your time,
Jon

Posted at Nginx Forum:

Hello!

On Fri, Nov 07, 2014 at 05:52:31PM -0500, jpherbst wrote:

json. I have tried using both chunked and not chunked (with content-length
header) encoding, they both yield the same result. I tried adding
“uwsgi_buffering off;” to my configuration, this allowed the request to
complete, but the next request hangs because nginx doesn’t think the
previous request is finished and I only have one uwsgi worker.

Does anyone have any ideas about what could cause this?

In the uwsgi protocol, end of a response is signalled by closing a
connection. Are connections properly closed by your backend?

See also here for some generic debugging hints:


Maxim D.
http://nginx.org/

Thank you for your reply Maxim, that’s exactly what’s happening. It’s
closing the socket for all the other requests I try, but not that one.
I
guess the problem is farther down the line somewhere.

Posted at Nginx Forum: