Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error while starting Puma server with workers

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:

  • Windows 7
  • Ruby 1.9.3p448 (2013-06-27) [i386-mingw32] MRI Rail 4.0.0 Puma
  • Version 2.7.1, codename: Earl of Sandwich Partition
like image 312
hadzy Avatar asked Dec 27 '13 13:12

hadzy


2 Answers

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.

like image 185
David Adafia Avatar answered Oct 08 '22 12:10

David Adafia


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.

like image 23
Holger Just Avatar answered Oct 08 '22 11:10

Holger Just