Eric Wong <[email protected]> wrote: > Eric Wong <[email protected]> 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 <[email protected]> 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 _______________________________________________ Mongrel-development mailing list [email protected] http://rubyforge.org/mailman/listinfo/mongrel-development
