unicorn Ruby/Rack server user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
From: Eric Wong <e@80x24.org>
To: Michael Fischer <mfischer@zendesk.com>
Cc: unicorn-public <unicorn-public@bogomips.org>
Subject: Re: nginx reverse proxy getting ECONNRESET
Date: Tue, 24 Mar 2015 23:23:20 +0000	[thread overview]
Message-ID: <20150324232320.GA9552@dcvr.yhbt.net> (raw)
In-Reply-To: <CABHxtY6pW0rtrEz74TQmFGdBiAeYMZr_0bubR7VCrmHPsU19Lg@mail.gmail.com>

Michael Fischer <mfischer@zendesk.com> wrote:
> On Tue, Mar 24, 2015 at 10:59 PM, Eric Wong <e@80x24.org> wrote:
> > Another likely explanation might be you're not draining rack.input every
> > request, since unicorn does lazy reads off the socket to prevent
> > rejected uploads from wasting disk I/O[1]
> >
> > So you can send a bigger POST request with my example to maybe
> > reproduce the issue.
> >
> > [1] you can use the Unicorn::PrereadInput middleware to forcibly
> >     disable the lazy read:
> >     http://unicorn.bogomips.org/Unicorn/PrereadInput.html
> Actually, these are quite large POST requests we're attempting to
> service (on the order of 4MB).  Can you elaborate on the mechanism in
> play here?

Unlike a lot of servers, unicorn will not attempt to buffer request
bodies on its own.  You'll need to actually process the POST request in
your app (via Rack/Rails/whatever accessing env["rack.input"]).

The PrereadInput middleware makes it behave like other servers
(at the cost of being slower if a request is worthless and rejected)

So there might be data sitting on the socket if your application
processing returns a response before it parsed the POST request.

In this case, the ECONNRESET messages are harmless and saves your
Ruby process from GC thrashing.

Actually, you can try setting up a Rack::Lobster instance but sending
a giant POST request?

------------- config.ru --------------
require 'rack/lobster'
run Rack::Lobster.new

  reply	other threads:[~2015-03-24 23:23 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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
2015-04-08 16:22 Gabe Martin-Dempesy

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=20150324232320.GA9552@dcvr.yhbt.net \
    --to=e@80x24.org \
    --cc=mfischer@zendesk.com \
    --cc=unicorn-public@bogomips.org \
    --subject='Re: nginx reverse proxy getting ECONNRESET' \


* 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:
 note: .onion URLs require Tor: https://www.torproject.org/

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


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