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


             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 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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  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 \
    --subject='Re: nginx reverse proxy getting ECONNRESET' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

unicorn Ruby/Rack server user+dev discussion/patches/pulls/bugs/help

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://yhbt.net/unicorn-public
	git clone --mirror http://ou63pmih66umazou.onion/unicorn-public

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 unicorn-public unicorn-public/ https://yhbt.net/unicorn-public \
		unicorn-public@yhbt.net unicorn-public@bogomips.org mongrel-unicorn@rubyforge.org mongrel-unicorn-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org
	public-inbox-index unicorn-public

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.lang.ruby.unicorn
	nntp://7fh6tueqddpjyxjmgtdiueylzoqt6pt7hec3pukyptlmohoowvhde4yd.onion/inbox.comp.lang.ruby.unicorn
 note: .onion URLs require Tor: https://www.torproject.org/

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

	../../unicorn.git

AGPL code for this site: git clone http://7fh6tueqddpjyxjmgtdiueylzoqt6pt7hec3pukyptlmohoowvhde4yd.onion/public-inbox.git