From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Luis Lavena Newsgroups: gmane.comp.lang.ruby.mongrel.devel Subject: Re: [PATCH] always set FD_CLOEXEC on sockets post-accept() Date: Wed, 15 Jul 2009 20:13:40 -0300 Message-ID: <71166b3b0907151613k4ebb22c4g253f53282f9860b0@mail.gmail.com> References: <20090709095624.GA2805@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="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1247699653 1117 80.91.229.12 (15 Jul 2009 23:14:13 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 15 Jul 2009 23:14:13 +0000 (UTC) To: mongrel-development-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org Original-X-From: mongrel-development-bounces-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org Thu Jul 16 01:14:06 2009 Return-path: Envelope-to: gclrmd-mongrel-development@m.gmane.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :from:date:message-id:subject:to:content-type :content-transfer-encoding; bh=8llp9zdi8F20Xw2+fa2WG9M3oWWr5LPXts/kqbMTk0o=; b=IlgBpp0dUQquLzZNJSB0aoM9lGiosZ3pSP/Sbuo+1Pitwj0xhPt0Oj56jZQvEuuBNX icCKEuAILUGTBDGMl3piAwOSLPoIQ9qw7TTWdE7pbvMO02E7ZLifU4t6MJeaBbSOpfYN CbV9GJBbfeHj0ulw1NwE/YoC0XRK5ruRbhL44= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; b=npApt/DvKTrI/CSrnQi2ASeEkHYcPWLAINMuzAsjfCQbMbHy67xppPZhhBzAR/21tn Y5/QVA7KO5wQ3TaDLqj+0VEiWuiwAzNqC6yQseZ5DLPRfvC1wImzVhO8B1xd2xoZIIxA ZC8xy2EkmVars//jCJfvW1uFFl/1UXprywCg4= In-Reply-To: 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:145 Archived-At: Received: from rubyforge.org ([205.234.109.19]) by lo.gmane.org with esmtp (Exim 4.50) id 1MRDfo-0001Xd-5b for gclrmd-mongrel-development@m.gmane.org; Thu, 16 Jul 2009 01:14:04 +0200 Received: from rubyforge.org (rubyforge.org [127.0.0.1]) by rubyforge.org (Postfix) with ESMTP id 99B361779930; Wed, 15 Jul 2009 19:14:03 -0400 (EDT) Received: from mail-fx0-f206.google.com (mail-fx0-f206.google.com [209.85.220.206]) by rubyforge.org (Postfix) with ESMTP id F01611858111 for ; Wed, 15 Jul 2009 19:14:00 -0400 (EDT) Received: by fxm2 with SMTP id 2so2650126fxm.35 for ; Wed, 15 Jul 2009 16:14:00 -0700 (PDT) Received: by 10.239.141.13 with SMTP id z13mr602361hbz.77.1247699640116; Wed, 15 Jul 2009 16:14:00 -0700 (PDT) List-Post: On Wed, Jul 15, 2009 at 1:31 PM, Evan Weaver wrote: > Luis, is this one of the commits you already accepted for 1.1.6 and frien= ds? > I think is not. Will review, but everything will be reflected in the history file. > Evan > > On Thu, Jul 9, 2009 at 2:56 AM, Eric Wong wrote: >> FD_CLOEXEC is not guaranteed to be inherited by the accept()-ed >> descriptors even if the listener socket has this set. =A0This can >> be a problem with applications that fork+exec long running >> background processes and our client expects us to close >> a connection to signal a completed response: the connection >> would only be closed when the background process closed it >> (when it exited), not when Mongrel closes the socket. >> >> This issue was discovered with a server other than Mongrel but >> the issue here is applicable to Mongrel as well. >> --- >> >> =A0This patch was based on the below branch >> =A0(against c365ba16d12a14bdf1cc50a26f67dd3b45f5a4d8) >> >> =A0> I used git-svn and added it to >> =A0> http://github.com/fauna/mongrel/tree/trunk_from_svn, where it can l= ie >> =A0> unchanged for reference. >> >> =A0P.S.: I know I used to have a commit bit to the Mongrel SVN but I >> =A0never really cared for it since I've always preferred the >> =A0mailing-patches-around-for-review form of development. =A0Let me know= if >> =A0pushing things to git://git.bogomips.org/mongrel.git for you to >> =A0pull is preferable in the future. >> >> =A0P.P.S: not sure if it's common around here, but I've long had mutt >> =A0setup to pipe messages to "git am" directly from the index or pager >> =A0and also diff syntax hilighting in the mutt pager. =A0It all makes pa= tch >> =A0review/testing *much* nicer without having to context switch out of a >> =A0terminal/screen. >> >> =A0lib/mongrel.rb | =A0 =A06 +++++- >> =A01 files changed, 5 insertions(+), 1 deletions(-) >> >> diff --git a/lib/mongrel.rb b/lib/mongrel.rb >> index f09a617..0619abe 100644 >> --- a/lib/mongrel.rb >> +++ b/lib/mongrel.rb >> @@ -278,7 +278,11 @@ module Mongrel >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 if defined?($tcp_cork_opts) and $tcp_cork_op= ts >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 client.setsockopt(*$tcp_cork_opts) rescu= e nil >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 end >> - >> + >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0if defined?(Fcntl::FD_CLOEXEC) >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0client.fcntl(Fcntl::F_SETFD, Fcntl::FD_= CLOEXEC) >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0end >> + >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 worker_list =3D @workers.list >> >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 if worker_list.length >=3D @num_processors >> -- >> Eric Wong >> _______________________________________________ >> Mongrel-development mailing list >> Mongrel-development-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org >> http://rubyforge.org/mailman/listinfo/mongrel-development >> > > > > -- > Evan Weaver > _______________________________________________ > Mongrel-development mailing list > Mongrel-development-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org > http://rubyforge.org/mailman/listinfo/mongrel-development > -- = Luis Lavena AREA 17 - Perfection in design is achieved not when there is nothing more to add, but rather when there is nothing more to take away. Antoine de Saint-Exup=E9ry