I am new to Rails and Puma, so the issue might be too silly with simple solutions, also please guide me if you think i am doing something wrong.
I am trying to start the Puma server for my rails with the worker. If i set workers to 0 with
puma -w0
the server starts perfectly but if i set worker to 1 or more it gives the following error:
E:\RoR_tryouts\ws_13.11.13\todo>puma -w3
[2120] *** SIGUSR2 not implemented, signal based restart unavailable!
[2120] *** SIGUSR1 not implemented, signal based restart unavailable!
[2120] Puma starting in cluster mode...
[2120] * Version 2.7.1, codename: Earl of Sandwich Partition
[2120] * Min threads: 0, max threads: 16
[2120] * Environment: development
[2120] * Process workers: 3
[2120] * Phased restart available
[2120] * Listening on tcp://0.0.0.0:9292
C:/Ruby/Ruby193/lib/ruby/gems/1.9.1/gems/puma-2.7.1/lib/puma/cluster.rb:229:in `trap': unsupported signal SIGCHLD (ArgumentError)
from C:/Ruby/Ruby193/lib/ruby/gems/1.9.1/gems/puma-2.7.1/lib/puma/cluster.rb:229:in `run'
from C:/Ruby/Ruby193/lib/ruby/gems/1.9.1/gems/puma-2.7.1/lib/puma/cli.rb:442:in `run'
from C:/Ruby/Ruby193/lib/ruby/gems/1.9.1/gems/puma-2.7.1/bin/puma:10:in `<top (required)>'
from C:/Ruby/Ruby193/bin/puma:23:in `load'
from C:/Ruby/Ruby193/bin/puma:23:in `<main>'
Specifications:
yup i had this same issue and found the solution at https://devcenter.heroku.com/articles/deploying-rails-applications-with-the-puma-web-server under the topic 'Workers'. If you're on windows orJRuby omit the line "workers Integer(ENV['WEB_CONCURRENCY'] || 2) " in your config/puma.rb file. it solved it for me. Read the link above for more info.
To cite from the Puma README:
Because of various platforms not being implement certain things, the following differences occur when Puma is used on different platforms:
- JRuby, Windows: server sockets are not seamless on restart, they must be closed and reopened. These platforms have no way to pass descriptors into a new process that is exposed to ruby
- JRuby, Windows: cluster mode is not supported due to a lack of fork(2)
- Windows: daemon mode is not supported due to a lack of fork(2)
As it clearly states, cluster mode (i.e. running a single puma instance with multiple workers) and daemon mode (detaching from the shell after starting) are not supported on Windows.
You should either use a differt OS (e.g. Linux) or use Puma in single-worker mode. You could manually start multiple Puma instance on different ports and loadbalance between them though, even on Windows. You just need a frontend loadbalancer for that and it isn't as seamless as the native cluster mode builtin to Puma.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With