mirror of mongrel-development@rubyforge.org (inactive)
 help / color / mirror / Atom feed
From: Eric Wong <normalperson-rMlxZR9MS24@public.gmane.org>
To: mongrel-development-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org
Subject: Re: [RFC Mongrel2] simpler response API + updated HTTP parser
Date: Tue, 27 Oct 2009 14:59:02 -0700	[thread overview]
Message-ID: <20091027215902.GA12821@dcvr.yhbt.net> (raw)
In-Reply-To: <20091008013542.GA12370-yBiyF41qdooeIZ0/mPfg9Q@public.gmane.org>

Eric Wong <normalperson-rMlxZR9MS24@public.gmane.org> wrote:
> Eric Wong <normalperson-rMlxZR9MS24@public.gmane.org> wrote:
> > Hi all,
> > 
> > I've pushed out some changes based on fauna/master[1] to
> > git://git.bogomips.org/ur-mongrel that includes a good chunk of the
> > platform-independent stuff found in Unicorn.

One more that I just pushed out to git://git.bogomips.org/ur-mongrel

>>From f1e493e98a76345b4a05b29e037826626138776b Mon Sep 17 00:00:00 2001
From: Eric Wong <normalperson-rMlxZR9MS24@public.gmane.org>
Date: Tue, 27 Oct 2009 14:38:51 -0700
Subject: [PATCH] tee_input: avoid IO#sync=true to workaround BSD stdio issue

IO#sync = true causes bad things with Ruby 1.8.x and stdio in
*BSDs.  Since Mongrel 1.x originally didn't use IO#sync=true and
needs to work on slow clients and a wider number of OSes than
Unicorn, it maybe be better to just avoid IO#sync=true instead
of an explicit seek-after-write (like Unicorn does).

This issue was tracked (and fixed) in ruby-core:26300[1], but a
MRI 1.8 release may be a while off and people have a tendency to
upgrade MRI slowly.

[1] http://redmine.ruby-lang.org/issues/show/2267
---
 lib/mongrel/tee_input.rb |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/lib/mongrel/tee_input.rb b/lib/mongrel/tee_input.rb
index 3605e20..cf20613 100644
--- a/lib/mongrel/tee_input.rb
+++ b/lib/mongrel/tee_input.rb
@@ -134,6 +134,10 @@ module Mongrel
         begin
           if parser.filter_body(dst, socket.readpartial(length, buf)).nil?
             @tmp.write(dst)
+            # This seek is to workaround a BSD stdio + MRI 1.8.x issue,
+            # [ruby-core:26300] but currently not needed unless we've
+            # set @tmp.sync=true
+            # @tmp.seek(0, IO::SEEK_END) if @tmp.sync
             return dst
           end
         rescue EOFError
@@ -155,7 +159,6 @@ module Mongrel
 
     def tmpfile
       tmp = Tempfile.new(Const::MONGREL_TMP_BASE)
-      tmp.sync = true
       tmp.binmode
       tmp
     end
-- 
Eric Wong

      parent reply	other threads:[~2009-10-27 21:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-12 23:57 [RFC Mongrel2] simpler response API + updated HTTP parser Eric Wong
     [not found] ` <20090912235729.GA9370-yBiyF41qdooeIZ0/mPfg9Q@public.gmane.org>
2009-10-08  1:35   ` Eric Wong
     [not found]     ` <20091008013542.GA12370-yBiyF41qdooeIZ0/mPfg9Q@public.gmane.org>
2009-10-27 21:59       ` Eric Wong [this message]
replies disabled, historical list

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