" error I have not been able to reliably reproduce this problem, so I will...">

Puma start calls "There is already a server associated with: <socket>" error

I have not been able to reliably reproduce this problem, so I will describe what is happening and hope that one of you wise cougar children there can help me.

I always stop and start puma at the end of my deployment process. I run pumactl -F <config_path> stop

that works and then a command puma -q -d -e staging -C <config_path>

that sometimes (not always) throws the following error:

[12802] Puma starting in cluster mode... 
[12802] * Version 2.11.3 (ruby 2.1.2-p95), codename: Intrepid Squirrel
[12802] * Min threads: 2, max threads: 4
[12802] * Environment: staging
[12802] * Process workers: 2
[12802] * Phased restart available 
[12802] * Listening on unix:///<app_dir>/tmp/puma/sockets/puma.sock 
<ruby_path>/2.1.0/gems/puma-2.11.3/lib/puma/binder.rb:284:in `add_unix_listener': There is already a server bound to: <app_dir>/tmp/puma/sockets/puma.sock (RuntimeError)
<ruby_path>/2.1.0/gems/puma-2.11.3/lib/puma/binder.rb:124:in `block in parse'
<ruby_path>/2.1.0/gems/puma-2.11.3/lib/puma/binder.rb:82:in `each'
<ruby_path>/2.1.0/gems/puma-2.11.3/lib/puma/binder.rb:82:in `parse'
<ruby_path>/2.1.0/gems/puma-2.11.3/lib/puma/cluster.rb:325:in `run'
<ruby_path>/2.1.0/gems/puma-2.11.3/lib/puma/cli.rb:216:in `run'
<ruby_path>/2.1.0/gems/puma-2.11.3/bin/puma:10:in `<top (required)>'
<ruby_path>/2.1.0/bin/puma:23:in `load'
<ruby_path>/2.1.0/bin/puma:23:in `<main>'

      

If I try to run the same puma run command again, it works.

Here's my puma config:

#!/usr/bin/env puma

directory "<app_dir>/current"
rackup "<app_dir>/current/config.ru"
environment "staging"

pidfile "<app_dir>/tmp/puma/pid"
state_path "<app_dir>/tmp/puma/state"
activate_control_app "<app_dir>/tmp/puma/sockets/pumactl.sock"

stdout_redirect "<app_dir>/shared/log/puma.error.log", "<app_dir>/shared/log/puma.access.log", true

threads 2,4

bind "unix:///<app_dir>/tmp/puma/sockets/puma.sock"

workers 2

      

My questions:

  • How can I reproduce this error?
  • How can I fix this? Is this a problem with puma or with my config?
+3


source to share


1 answer


Instead of running both commands ...

pumactl -F <config_path> stop
puma -q -d -e <env> -C <config_path>

      

just use the reboot command:

pumactl -F <config_path> restart

      




Description

There is a Restarting section in the puma README which does not mention calling the stop and start commands one after the other. Since this use case is not supported, using the set method for restart

puma server will most likely fix this issue.

Note

I have not been able to consistently reproduce this puma error, so I cannot 100% confirm that using it pumactl restart

fixes the problem. (Even though puma has no support pumactl stop

, it puma

follows that it does.) If anyone continues this issue while using a supported one pumactl restart

, please let me know so I can change this answer.

+1


source







All Articles