unicorn Ruby/Rack server user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
From: Gabe Martin-Dempesy <gabe@zendesk.com>
To: unicorn-public@bogomips.org
Cc: e@80x24.org
Subject: Re: nginx reverse proxy getting ECONNRESET
Date: Wed, 8 Apr 2015 09:22:03 -0700	[thread overview]
Message-ID: <FC91211E-FD32-432C-92FC-0318714C2170@zendesk.com> (raw)

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)

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.

             reply	other threads:[~2015-04-08 16:22 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-08 16:22 Gabe Martin-Dempesy [this message]
  -- strict thread matches above, loose matches on Subject: below --
2015-03-24 22:43 nginx reverse proxy getting ECONNRESET 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

  List information: https://yhbt.net/unicorn/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=FC91211E-FD32-432C-92FC-0318714C2170@zendesk.com \
    --to=gabe@zendesk.com \
    --cc=e@80x24.org \
    --cc=unicorn-public@bogomips.org \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox


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).