Ernest W. Durbin III
2013-Nov-01 19:30 UTC
[ISSUE] Unicorn appears to be leaking TCP sockets
Gist containing configs and logs: https://gist.github.com/ewdurbin/1d9d2ea14a4231a5e7cc Environment: Unicorn 4.6.3 Ruby 2.0.0-p247 When started via the config above, Unicorn is grabbing an extra TCP socket each time it is reloaded via SIGUSR2. Even though I''ve configured it to listen on a unix socket only. SIGHUP''ing the master process releases all of the TCP sockets. Any assistance would be appreciated. - Ernest W. Durbin III _______________________________________________ Unicorn mailing list - mongrel-unicorn@rubyforge.org http://rubyforge.org/mailman/listinfo/mongrel-unicorn Do not quote signatures (like this one) or top post when replying
"Ernest W. Durbin III" <ewdurbin@gmail.com> wrote:> Gist containing configs and logs: > https://gist.github.com/ewdurbin/1d9d2ea14a4231a5e7ccI was stumped until I saw your command-line: "-p", "/var/run/marketing-staging/unicorn.pid" PID file path is ''-P'' (but we recommend using the config file for that) Pushing out the following: ------------------------8<------------------------------------ Subject: [PATCH] bin/*: enforce -p/--port argument to be a valid integer Users may confuse ''-p'' with the (to-be-deprecated) ''-P/--pid'' option, leading to surprising behavior if a pathname is passed as a port, because String#to_i would convert it to zero, causing: TCPServer.new(host, port = 0) to bind to a random, unused port. --- bin/unicorn | 6 +++--- bin/unicorn_rails | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/bin/unicorn b/bin/unicorn index 01984f8..c272e43 100755 --- a/bin/unicorn +++ b/bin/unicorn @@ -47,9 +47,9 @@ op = OptionParser.new("", 24, '' '') do |opts| rackup_opts[:set_listener] = true end - opts.on("-p", "--port PORT", - "use PORT (default: #{Unicorn::Const::DEFAULT_PORT})") do |p| - rackup_opts[:port] = p.to_i + opts.on("-p", "--port PORT", Integer, + "use PORT (default: #{Unicorn::Const::DEFAULT_PORT})") do |port| + rackup_opts[:port] = port rackup_opts[:set_listener] = true end diff --git a/bin/unicorn_rails b/bin/unicorn_rails index 4bd599f..b080846 100755 --- a/bin/unicorn_rails +++ b/bin/unicorn_rails @@ -48,9 +48,9 @@ op = OptionParser.new("", 24, '' '') do |opts| rackup_opts[:set_listener] = true end - opts.on("-p", "--port PORT", - "use PORT (default: #{Unicorn::Const::DEFAULT_PORT})") do |p| - rackup_opts[:port] = p.to_i + opts.on("-p", "--port PORT", Integer, + "use PORT (default: #{Unicorn::Const::DEFAULT_PORT})") do |port| + rackup_opts[:port] = port rackup_opts[:set_listener] = true end _______________________________________________ Unicorn mailing list - mongrel-unicorn@rubyforge.org http://rubyforge.org/mailman/listinfo/mongrel-unicorn Do not quote signatures (like this one) or top post when replying
Ernest W. Durbin III
2013-Nov-01 20:08 UTC
Re: [ISSUE] Unicorn appears to be leaking TCP sockets
On Fri, Nov 1, 2013 at 4:07 PM, Eric Wong <normalperson@yhbt.net> wrote:> "Ernest W. Durbin III" <ewdurbin@gmail.com> wrote: >> Gist containing configs and logs: >> https://gist.github.com/ewdurbin/1d9d2ea14a4231a5e7cc > > I was stumped until I saw your command-line: > > "-p", "/var/run/marketing-staging/unicorn.pid" > > PID file path is ''-P'' (but we recommend using the config file for that) > > Pushing out the following:Gorgeous! Thank you for the swift response.> ------------------------8<------------------------------------ > Subject: [PATCH] bin/*: enforce -p/--port argument to be a valid integer > > Users may confuse ''-p'' with the (to-be-deprecated) ''-P/--pid'' > option, leading to surprising behavior if a pathname is passed as a > port, because String#to_i would convert it to zero, causing: > > TCPServer.new(host, port = 0) > > to bind to a random, unused port. > --- > bin/unicorn | 6 +++--- > bin/unicorn_rails | 6 +++--- > 2 files changed, 6 insertions(+), 6 deletions(-) > > diff --git a/bin/unicorn b/bin/unicorn > index 01984f8..c272e43 100755 > --- a/bin/unicorn > +++ b/bin/unicorn > @@ -47,9 +47,9 @@ op = OptionParser.new("", 24, '' '') do |opts| > rackup_opts[:set_listener] = true > end > > - opts.on("-p", "--port PORT", > - "use PORT (default: #{Unicorn::Const::DEFAULT_PORT})") do |p| > - rackup_opts[:port] = p.to_i > + opts.on("-p", "--port PORT", Integer, > + "use PORT (default: #{Unicorn::Const::DEFAULT_PORT})") do |port| > + rackup_opts[:port] = port > rackup_opts[:set_listener] = true > end > > diff --git a/bin/unicorn_rails b/bin/unicorn_rails > index 4bd599f..b080846 100755 > --- a/bin/unicorn_rails > +++ b/bin/unicorn_rails > @@ -48,9 +48,9 @@ op = OptionParser.new("", 24, '' '') do |opts| > rackup_opts[:set_listener] = true > end > > - opts.on("-p", "--port PORT", > - "use PORT (default: #{Unicorn::Const::DEFAULT_PORT})") do |p| > - rackup_opts[:port] = p.to_i > + opts.on("-p", "--port PORT", Integer, > + "use PORT (default: #{Unicorn::Const::DEFAULT_PORT})") do |port| > + rackup_opts[:port] = port > rackup_opts[:set_listener] = true > end > > _______________________________________________ > Unicorn mailing list - mongrel-unicorn@rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-unicorn > Do not quote signatures (like this one) or top post when replying_______________________________________________ Unicorn mailing list - mongrel-unicorn@rubyforge.org http://rubyforge.org/mailman/listinfo/mongrel-unicorn Do not quote signatures (like this one) or top post when replying