unicorn Ruby/Rack server user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
* Re: nginx reverse proxy getting ECONNRESET
@ 2015-04-08 16:22 Gabe Martin-Dempesy
  0 siblings, 0 replies; 13+ messages in thread
From: Gabe Martin-Dempesy @ 2015-04-08 16:22 UTC (permalink / raw)
  To: unicorn-public; +Cc: e

Follow up on the resolution.

Data was being left in the socket, although it wasn’t immediately obvious why. The affected end point received gzipped POST bodies, and would process this somewhat like this:

    uncompressed_body = StringIO.new(Zlib::GzipReader.new(request.body).read)
    process(uncompressed_body)

At the end of each request, all of the uncompressed data had been consumed and `uncompressed_body.eof?` would always be true. However, GzipReader#close wasn’t explicitly called, causing anywhere between 1 and 7 trailing bytes of the 8 byte gzip footer to remain unread in request.body (rack.input) in a small portion of requests. Rewriting this to explicitly close the GzipReader forces it to read and validate the footer, and leaves us with a completely consumed request.body.

Thanks for your help identifying the root cause.


^ permalink raw reply	[flat|nested] 13+ messages in thread
* nginx reverse proxy getting ECONNRESET
@ 2015-03-24 22:43 Michael Fischer
  2015-03-24 22:54 ` Eric Wong
  0 siblings, 1 reply; 13+ messages in thread
From: Michael Fischer @ 2015-03-24 22:43 UTC (permalink / raw)
  To: unicorn-public

We have an nginx 1.6.2 proxy in front of a Unicorn 4.8.3 server that
is frequently reporting the following error:

2015/03/24 01:46:01 [error] 11217#0: *872231 readv() failed (104:
Connection reset by peer) while reading upstream

The interesting things are:

1) The upstream is a Unix domain socket (to which Unicorn is bound)
2) Unicorn isn't reporting that a child died in the error log (and I
verified their lifetimes with ps(1))

Any hints as to what we should look for?

Thanks,

--Michael


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2015-04-08 16:22 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-08 16:22 nginx reverse proxy getting ECONNRESET Gabe Martin-Dempesy
  -- strict thread matches above, loose matches on Subject: below --
2015-03-24 22:43 Michael Fischer
2015-03-24 22:54 ` Eric Wong
2015-03-24 22:59   ` Eric Wong
2015-03-24 23:04     ` Michael Fischer
2015-03-24 23:23       ` Eric Wong
2015-03-24 23:29         ` Michael Fischer
2015-03-24 23:46           ` Eric Wong
2015-03-24 23:55             ` Eric Wong
2015-03-25  9:41               ` Michael Fischer
2015-03-25 10:12                 ` Eric Wong
2015-03-25  9:48             ` Michael Fischer
2015-03-24 23:02   ` Michael Fischer

Code repositories for project(s) associated with this inbox:

	../../../unicorn.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).