unicorn Ruby/Rack server user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
* [ISSUE] Unicorn appears to be leaking TCP sockets
@ 2013-11-01 19:30 Ernest W. Durbin III
  2013-11-01 20:07 ` Eric Wong
  0 siblings, 1 reply; 3+ messages in thread
From: Ernest W. Durbin III @ 2013-11-01 19:30 UTC (permalink / raw)
  To: unicorn list

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [ISSUE] Unicorn appears to be leaking TCP sockets
  2013-11-01 19:30 [ISSUE] Unicorn appears to be leaking TCP sockets Ernest W. Durbin III
@ 2013-11-01 20:07 ` Eric Wong
  2013-11-01 20:08   ` Ernest W. Durbin III
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Wong @ 2013-11-01 20:07 UTC (permalink / raw)
  To: unicorn list

"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:
------------------------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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [ISSUE] Unicorn appears to be leaking TCP sockets
  2013-11-01 20:07 ` Eric Wong
@ 2013-11-01 20:08   ` Ernest W. Durbin III
  0 siblings, 0 replies; 3+ messages in thread
From: Ernest W. Durbin III @ 2013-11-01 20:08 UTC (permalink / raw)
  To: unicorn list

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-11-01 20:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-01 19:30 [ISSUE] Unicorn appears to be leaking TCP sockets Ernest W. Durbin III
2013-11-01 20:07 ` Eric Wong
2013-11-01 20:08   ` Ernest W. Durbin III

Code repositories for project(s) associated with this public inbox

	https://yhbt.net/unicorn.git/

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).