From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eric Wong Newsgroups: gmane.comp.lang.ruby.mongrel.devel Subject: Re: [RFC Mongrel2] simpler response API + updated HTTP parser Date: Tue, 27 Oct 2009 14:59:02 -0700 Message-ID: <20091027215902.GA12821@dcvr.yhbt.net> References: <20090912235729.GA9370@dcvr.yhbt.net> <20091008013542.GA12370@dcvr.yhbt.net> Reply-To: mongrel-development-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1256680754 24760 80.91.229.12 (27 Oct 2009 21:59:14 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 27 Oct 2009 21:59:14 +0000 (UTC) To: mongrel-development-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org Original-X-From: mongrel-development-bounces-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org Tue Oct 27 22:59:07 2009 Return-path: Envelope-to: gclrmd-mongrel-development@m.gmane.org Content-Disposition: inline In-Reply-To: <20091008013542.GA12370-yBiyF41qdooeIZ0/mPfg9Q@public.gmane.org> User-Agent: Mutt/1.5.18 (2008-05-17) X-BeenThere: mongrel-development-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: mongrel-development-bounces-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org Errors-To: mongrel-development-bounces-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org Xref: news.gmane.org gmane.comp.lang.ruby.mongrel.devel:156 Archived-At: Received: from rubyforge.org ([205.234.109.19]) by lo.gmane.org with esmtp (Exim 4.50) id 1N2u4J-0007pl-13 for gclrmd-mongrel-development@m.gmane.org; Tue, 27 Oct 2009 22:59:07 +0100 Received: from rubyforge.org (rubyforge.org [127.0.0.1]) by rubyforge.org (Postfix) with ESMTP id 6C1111D7885E; Tue, 27 Oct 2009 17:59:06 -0400 (EDT) Received: from dcvr.yhbt.net (dcvr.yhbt.net [64.71.152.64]) by rubyforge.org (Postfix) with ESMTP id 864E71D7885D for ; Tue, 27 Oct 2009 17:59:03 -0400 (EDT) Received: from localhost (unknown [12.186.229.34]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPSA id 992741F606; Tue, 27 Oct 2009 21:59:02 +0000 (UTC) List-Post: Eric Wong wrote: > Eric Wong 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 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