* Mongrel doesn't set close-on-exec on its listen socket @ 2008-07-22 16:31 Jos Backus [not found] ` <20080722163104.GA82787-/yjMewivvDbpLr52UxKYZsM6rOWSkUom@public.gmane.org> 0 siblings, 1 reply; 6+ messages in thread From: Jos Backus @ 2008-07-22 16:31 UTC (permalink / raw) To: mongrel-development; +Cc: puppet-dev Mongrel, at least in 1.1.4, doesn't set the close-on-exec flag on the listen socket. This leads to trouble in programs that use Mongrel and fork other programs (like puppetmasterd, part of Puppet). For an example, see http://groups.google.com/group/puppet-dev/browse_thread/thread/463f0f8cfc80cc43 Please consider applying something like the following patch: --- lib/mongrel.rb.orig 2008-07-17 17:44:42.000000000 -0400 +++ lib/mongrel.rb 2008-07-17 17:44:53.000000000 -0400 @@ -92,7 +92,9 @@ tries = 0 @socket = TCPServer.new(host, port) + @socket.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC) + @classifier = URIClassifier.new @host = host @port = port If somebody can show me what the Mongrel way of making this (POSIX) platform-specific, that would be appreciated. -- Jos Backus jos at catnook.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Developers" group. To post to this group, send email to puppet-dev@googlegroups.com To unsubscribe from this group, send email to puppet-dev-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en -~----------~----~----~----~------~----~------~--~--- ^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <20080722163104.GA82787-/yjMewivvDbpLr52UxKYZsM6rOWSkUom@public.gmane.org>]
* Re: Mongrel doesn't set close-on-exec on its listen socket [not found] ` <20080722163104.GA82787-/yjMewivvDbpLr52UxKYZsM6rOWSkUom@public.gmane.org> @ 2008-08-18 21:59 ` Eric Wong 2008-08-19 3:08 ` [Mongrel-development] " Jos Backus 0 siblings, 1 reply; 6+ messages in thread From: Eric Wong @ 2008-08-18 21:59 UTC (permalink / raw) To: mongrel-development-GrnCvJ7WPxnNLxjTenLetw Cc: puppet-dev-/JYPxA39Uh5TLH3MbocFFw Jos Backus <jos-ER9Rz4keOotBDgjK7y7TUQ@public.gmane.org> wrote: > Mongrel, at least in 1.1.4, doesn't set the close-on-exec flag on the listen > socket. This leads to trouble in programs that use Mongrel and fork other > programs (like puppetmasterd, part of Puppet). For an example, see > http://groups.google.com/group/puppet-dev/browse_thread/thread/463f0f8cfc80cc43 > > Please consider applying something like the following patch: > > --- lib/mongrel.rb.orig 2008-07-17 17:44:42.000000000 -0400 > +++ lib/mongrel.rb 2008-07-17 17:44:53.000000000 -0400 > @@ -92,7 +92,9 @@ > > tries = 0 > @socket = TCPServer.new(host, port) > + @socket.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC) > + > @classifier = URIClassifier.new > @host = host > @port = port > > If somebody can show me what the Mongrel way of making this (POSIX) > platform-specific, that would be appreciated. This probably works: diff --git a/lib/mongrel.rb b/lib/mongrel.rb index 8b5dfe2..027bfdb 100644 --- a/lib/mongrel.rb +++ b/lib/mongrel.rb @@ -91,6 +91,9 @@ module Mongrel tries = 0 @socket = TCPServer.new(host, port) + if defined?(Fcntl::FD_CLOEXEC) + @socket.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC) + end @classifier = URIClassifier.new @host = host -- Eric Wong ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [Mongrel-development] Mongrel doesn't set close-on-exec on its listen socket 2008-08-18 21:59 ` Eric Wong @ 2008-08-19 3:08 ` Jos Backus [not found] ` <20080819030844.GA53303-/yjMewivvDbpLr52UxKYZsM6rOWSkUom@public.gmane.org> 0 siblings, 1 reply; 6+ messages in thread From: Jos Backus @ 2008-08-19 3:08 UTC (permalink / raw) To: mongrel-development, puppet-dev On Mon, Aug 18, 2008 at 02:59:21PM -0700, Eric Wong wrote: > This probably works: > > diff --git a/lib/mongrel.rb b/lib/mongrel.rb > index 8b5dfe2..027bfdb 100644 > --- a/lib/mongrel.rb > +++ b/lib/mongrel.rb > @@ -91,6 +91,9 @@ module Mongrel > > tries = 0 > @socket = TCPServer.new(host, port) > + if defined?(Fcntl::FD_CLOEXEC) > + @socket.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC) > + end > > @classifier = URIClassifier.new > @host = host Looks reasonable to me. Thanks, Eric. Can somebody commit, please? -- Jos Backus jos at catnook.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Developers" group. To post to this group, send email to puppet-dev@googlegroups.com To unsubscribe from this group, send email to puppet-dev+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en -~----------~----~----~----~------~----~------~--~--- ^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <20080819030844.GA53303-/yjMewivvDbpLr52UxKYZsM6rOWSkUom@public.gmane.org>]
* Re: Mongrel doesn't set close-on-exec on its listen socket [not found] ` <20080819030844.GA53303-/yjMewivvDbpLr52UxKYZsM6rOWSkUom@public.gmane.org> @ 2008-08-20 8:27 ` Eric Wong [not found] ` <20080820082737.GA2403-G9TX8C5UF5wdbCeoMzGj59i2O/JbrIOy@public.gmane.org> 0 siblings, 1 reply; 6+ messages in thread From: Eric Wong @ 2008-08-20 8:27 UTC (permalink / raw) To: mongrel-development-GrnCvJ7WPxnNLxjTenLetw Jos Backus <jos-ER9Rz4keOotBDgjK7y7TUQ@public.gmane.org> wrote: > On Mon, Aug 18, 2008 at 02:59:21PM -0700, Eric Wong wrote: > > This probably works: > > > > diff --git a/lib/mongrel.rb b/lib/mongrel.rb > > index 8b5dfe2..027bfdb 100644 > > --- a/lib/mongrel.rb > > +++ b/lib/mongrel.rb > > @@ -91,6 +91,9 @@ module Mongrel > > > > tries = 0 > > @socket = TCPServer.new(host, port) > > + if defined?(Fcntl::FD_CLOEXEC) > > + @socket.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC) > > + end > > > > @classifier = URIClassifier.new > > @host = host > > Looks reasonable to me. Thanks, Eric. Can somebody commit, please? I've just committed it, r1036 to trunk. Thanks for the report! -- Eric Wong ^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <20080820082737.GA2403-G9TX8C5UF5wdbCeoMzGj59i2O/JbrIOy@public.gmane.org>]
* Re: Mongrel doesn't set close-on-exec on its listen socket [not found] ` <20080820082737.GA2403-G9TX8C5UF5wdbCeoMzGj59i2O/JbrIOy@public.gmane.org> @ 2008-11-04 20:41 ` Jos Backus [not found] ` <20081104204159.GA48584-/yjMewivvDbpLr52UxKYZsM6rOWSkUom@public.gmane.org> 0 siblings, 1 reply; 6+ messages in thread From: Jos Backus @ 2008-11-04 20:41 UTC (permalink / raw) To: mongrel-development-GrnCvJ7WPxnNLxjTenLetw On Wed, Aug 20, 2008 at 01:27:37AM -0700, Eric Wong wrote: > Jos Backus <jos-ER9Rz4keOotBDgjK7y7TUQ@public.gmane.org> wrote: > > On Mon, Aug 18, 2008 at 02:59:21PM -0700, Eric Wong wrote: > > > This probably works: > > > > > > diff --git a/lib/mongrel.rb b/lib/mongrel.rb > > > index 8b5dfe2..027bfdb 100644 > > > --- a/lib/mongrel.rb > > > +++ b/lib/mongrel.rb > > > @@ -91,6 +91,9 @@ module Mongrel > > > > > > tries = 0 > > > @socket = TCPServer.new(host, port) > > > + if defined?(Fcntl::FD_CLOEXEC) > > > + @socket.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC) > > > + end > > > > > > @classifier = URIClassifier.new > > > @host = host > > > > Looks reasonable to me. Thanks, Eric. Can somebody commit, please? > > I've just committed it, r1036 to trunk. Thanks for the report! Thanks Eric. The patch is probably incomplete, as I just noticed a problem: /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:94:in `initialize': uninitialized constant Mongrel::HttpServer::Fcntl (NameError) That code doesn't have the defined? test. But even if it did, it wouldn't work as `fcntl' hadn't been require'd so the Fcntl::FD_CLOEXEC constant couldn't be available until it was (if it was available). So the right thing to do is to also apply this patch which explicitly require's `fcntl': --- mongrel.rb- 2008-11-04 15:39:01.000000000 -0500 +++ mongrel.rb 2008-11-04 15:26:38.000000000 -0500 @@ -7,6 +7,7 @@ require 'etc' require 'uri' require 'stringio' +require 'fcntl' # Compiled Mongrel extension require 'http11' -- Jos Backus jos at catnook.com ^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <20081104204159.GA48584-/yjMewivvDbpLr52UxKYZsM6rOWSkUom@public.gmane.org>]
* Re: Mongrel doesn't set close-on-exec on its listen socket [not found] ` <20081104204159.GA48584-/yjMewivvDbpLr52UxKYZsM6rOWSkUom@public.gmane.org> @ 2008-11-08 2:15 ` Eric Wong 0 siblings, 0 replies; 6+ messages in thread From: Eric Wong @ 2008-11-08 2:15 UTC (permalink / raw) To: mongrel-development-GrnCvJ7WPxnNLxjTenLetw Jos Backus <jos-ER9Rz4keOotBDgjK7y7TUQ@public.gmane.org> wrote: > On Wed, Aug 20, 2008 at 01:27:37AM -0700, Eric Wong wrote: > > Jos Backus <jos-ER9Rz4keOotBDgjK7y7TUQ@public.gmane.org> wrote: > > > On Mon, Aug 18, 2008 at 02:59:21PM -0700, Eric Wong wrote: > > > > This probably works: > > > > > > Looks reasonable to me. Thanks, Eric. Can somebody commit, please? > > > > I've just committed it, r1036 to trunk. Thanks for the report! > > Thanks Eric. The patch is probably incomplete, as I just noticed a problem: > > /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:94:in > `initialize': uninitialized constant Mongrel::HttpServer::Fcntl (NameError) > > That code doesn't have the defined? test. But even if it did, it wouldn't work > as `fcntl' hadn't been require'd so the Fcntl::FD_CLOEXEC constant couldn't be > available until it was (if it was available). > > So the right thing to do is to also apply this patch which explicitly > require's `fcntl': Applied, thanks! -- Eric Wong ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2008-11-08 3:19 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2008-07-22 16:31 Mongrel doesn't set close-on-exec on its listen socket Jos Backus [not found] ` <20080722163104.GA82787-/yjMewivvDbpLr52UxKYZsM6rOWSkUom@public.gmane.org> 2008-08-18 21:59 ` Eric Wong 2008-08-19 3:08 ` [Mongrel-development] " Jos Backus [not found] ` <20080819030844.GA53303-/yjMewivvDbpLr52UxKYZsM6rOWSkUom@public.gmane.org> 2008-08-20 8:27 ` Eric Wong [not found] ` <20080820082737.GA2403-G9TX8C5UF5wdbCeoMzGj59i2O/JbrIOy@public.gmane.org> 2008-11-04 20:41 ` Jos Backus [not found] ` <20081104204159.GA48584-/yjMewivvDbpLr52UxKYZsM6rOWSkUom@public.gmane.org> 2008-11-08 2:15 ` Eric Wong
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).