unicorn Ruby/Rack server user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
From: Eric Wong <normalperson@yhbt.net>
To: Chris Wanstrath <chris@ozmm.org>
Cc: mongrel-unicorn@rubyforge.org
Subject: Re: POST Body Truncated
Date: Tue, 6 Oct 2009 15:52:19 -0700	[thread overview]
Message-ID: <20091006225219.GA7831@dcvr.yhbt.net> (raw)
In-Reply-To: <20091006223259.GB5460@dcvr.yhbt.net>

Eric Wong <normalperson@yhbt.net> wrote:
> Chris Wanstrath <chris@ozmm.org> wrote:
> > On Tue, Oct 6, 2009 at 2:50 PM, Eric Wong <normalperson@yhbt.net> wrote:
> > 
> > > No worries, I'm working on a a reproducible test case.  Can you try
> > > and see if you're using curl's -F to POST, you _don't_ hit it?
> > 
> > `curl -F` does NOT trigger POST body truncation.
> 
> Still trying to reproduce this, I think you're hitting a buffer boundary
> in nginx and triggering a bug in Unicorn::TeeInput somewhere.   You may
> be able to increase some userspace buffer sizes in nginx to
> workaround it until I (or somebody else) can fix it (hopefully very soon
> now).

OK, here's a workaround that should work for now.  I have to hit the
road in a few minutes but will be back on a computer in a few hours.

This only affects older Rails (and I'm supposed to still be supporting
1.2.x!) and its interaction with a wrapped CGI.stdinput somewhere is
going bad...

diff --git a/lib/unicorn/app/old_rails.rb b/lib/unicorn/app/old_rails.rb
index ba1260a..51bda52 100644
--- a/lib/unicorn/app/old_rails.rb
+++ b/lib/unicorn/app/old_rails.rb
@@ -14,6 +14,8 @@ module Unicorn; module App; end; end
 class Unicorn::App::OldRails
 
   def call(env)
+    env['rack.input'].each { |x| }
+    env['rack.input'].rewind
     cgi = Unicorn::CGIWrapper.new(env)
     begin
       Dispatcher.dispatch(cgi,
---

I'll have a better diagnosis+fix+test when I return.
Sorry for the bug :x

-- 
Eric Wong

  reply	other threads:[~2009-10-06 22:55 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-06 21:13 POST Body Truncated Chris Wanstrath
2009-10-06 21:22 ` Eric Wong
2009-10-06 21:26   ` Chris Wanstrath
2009-10-06 21:30     ` Eric Wong
2009-10-06 21:46       ` Chris Wanstrath
2009-10-06 21:50         ` Eric Wong
2009-10-06 21:58           ` Chris Wanstrath
2009-10-06 22:32             ` Eric Wong
2009-10-06 22:52               ` Eric Wong [this message]
2009-10-06 22:57                 ` Chris Wanstrath
2009-10-07  3:04                   ` Eric Wong

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=20091006225219.GA7831@dcvr.yhbt.net \
    --to=normalperson@yhbt.net \
    --cc=chris@ozmm.org \
    --cc=mongrel-unicorn@rubyforge.org \
    /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
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

	https://yhbt.net/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).