puma: Restarting via `SIGUSR2` broken in 3.9.0 works in 3.8.2

Steps to reproduce

  1. Updated application from puma 3.8.2 to 3.9.0

  2. start puma server bundle exec puma -p 3000

  3. send USR2 kill -SIGUSR2 <pid>

Expected behavior

Puma server should be restarting and does so correctly in 3.8.2

Actual behavior

With version 3.9.0 the outcome is

* Listening on tcp://0.0.0.0:3000
Use Ctrl-C to stop
* Restarting...
/usr/local/lib/ruby/2.3.0/rubygems/dependency.rb:319:in `to_specs': Could not find 'puma' (>= 0.a) among 19 total gem(s) (Gem::LoadError)

System configuration

Ruby version: ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-linux] Rails version: rails-5.0.3

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 1
  • Comments: 42 (31 by maintainers)

Commits related to this issue

Most upvoted comments

none of the options and workarounds worked for me on 3.9.1, had to rollback to 3.8.2 which works fine

Closed by #1385

I can confirm that switching back to puma 3.8.1 solved the issue.

@grosser https://github.com/stereobooster/ruby-server-experiment/tree/master/puma-symlink-grosser

UPD: @grosser why do you prefer USR2 over USR1 restart?

PS simplified patch

require 'bundler/setup'
on_restart do
  ENV.replace(Bundler.clean_env)
end

@stereobooster the error is different:

As mentioned here, fIx is for:

uninitialized constant #<Class:#<Puma::DSL:0x0055883f37e188>>::Bundler (NameError)

but the error I (and probably others) am getting is:

`find_spec_for_exe': can't find gem puma (>= 0.a) (Gem::GemNotFoundException)

Info:

$ ~/.rvm/bin/rvm ruby-2.4.1 do ruby -v
ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]

$ ~/.rvm/bin/rvm ruby-2.4.1 do gem -v
2.6.11

$ ~/.rvm/bin/rvm ruby-2.4.1 do bundle -v
Bundler version 1.15.1

$ ~/.rvm/bin/rvm ruby-2.4.1 do bundle exec rails -v
Rails 5.1.2

$ uname -a                                                                                                                                                                                            
Linux ip-172-31-30-115 4.4.0-83-generic #106-Ubuntu SMP Mon Jun 26 17:54:43 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux 

Okay, using puma-3.8.1 is the clean and simple workaround. Thanks @dguettler and @tagliala.

Same here. Workaround didn’t help, downgrading to 3.8.2 works

ruby -v
ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]

gem -v
2.6.12

bundle -v
Bundler version 1.15.1

bundle exec rails -v
Rails 5.1.2

uname -a
Linux <NAME> 3.10.0-514.el7.x86_64 #1 SMP Tue Nov 22 16:42:41 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

Experienced the same problem - simply updating to the latest version of bundler (1.15.1) fixed it for me.

add gemspec to Gemfile and remove the dependencies like https://github.com/puma/puma/pull/1313 does then

gem uninstall puma -a
bundle exec puma test/rackup/hello.ru
ps -ef | grep puma
kill -SIGUSR2 <puma-pid>

-> kaboom

hmm I think this is because it restarts with an environment that does not have bundler so should tweak the restart command to include bundle exec … I though I tried that … for now might be able to fix it by setting --restart-command manually will take a look shortly