-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Puma hangs on shutting down workers when received SIGINT #1674
Comments
I seem to start experiencing this with 2.6.0-rc1 on travis - maybe an odd coincidence? https://travis-ci.com/socketry/falcon/jobs/163846367 - scroll to the end. |
@ioquatix I think you are seeing https://bugs.ruby-lang.org/issues/15499 We see it for our app using Puma cluster mode, it does not exit on SIGTERM. On Heroku, we are getting R12 - Exit timeout errors. |
I believe this issue may have also been causing failing tests on Travis when ruby-head was 2.6.0dev, the tests are skipped on Windows/Appveyor due to lack of |
I think this is fixed by #1738 also |
This sounds like a bug in ruby 2.6. |
Let me see if I can reproduce the issue in 2.6.1 |
I believe this issue has been around since 2018-Aug, between r64316 and r64376. Both trunk and 2.6.1 are failing currently, and have been since that time. Some travis build info: Failed builds Passing builds |
I think so too, 2.6 changed the behaviour of our specs, that started and stopped our application using Puma in cluster mode. I've extracted the code to https://github.com/dentarg/gists/tree/master/gists/ruby-bug-15499 to reproduce the problem. Before 2.6 our specs was able to stop Puma without leaving any Ruby processes behind. I made some comments about this in https://bugs.ruby-lang.org/issues/15499 but it hasn't gone anywhere since. I've been thinking about opening a new bug, but we switched our application to use Puma in single mode so the issue hasn't been pressing. I can chime in if anyone here opens a new bug. (Also, the Heroku R12 errors went away when switching to single mode.) |
@MSP-Greg I have tested #1741, see https://github.com/dentarg/gists/tree/master/gists/ruby-bug-15499#261--httpsgithubcompumapumapull1741. Seems like it behaves as 2.5.3 does. |
Thanks for testing.
To clarify, that means that the PR fixes the issue you've had with Ruby 2.6/trunk? |
Yes, I think so, at least some of it. Something I didn't do but could be done: try to reproduce the problem on Heroku (but it looks like the original post is doing something similar) |
Maybe @schneems has seen the issue with 2.6/trunk somewhere? |
It seems that this issue is also in Ruby 2.5.4 now. |
Not only that - puma doesn't work in clustered mode at all with this ruby update! I'll put in another ticket for that though. |
@mltsy have you tested 2.5.5? afaik Ruby 2.5.5 was released to handle the regression in 2.5.4 |
Ah! Indeed. I just saw, as I was going to put in a ticket, that there was actually ticket submitted and resolved for that very reason that I had missed previously because it was already closed :) Thanks! And it looks like that update also resolves the issue in this ticket - although perhaps it still exists in the Ruby 2.6 branch? |
If anyone wants to try a PR that may solve the clustered issue, the following in a gemfile:
|
That does seem to allow puma to shutdown gracefully in ruby 2.5.4 with that branch. 👍 (However, requests still don't get through in clustered mode in ruby 2.5.4 even with that branch) |
Thanks for checking.
Not good. Any idea if 2.5.5 fixes it (or using 2.6.2)? |
2.5.5 does fix both issues, yeah! |
Good. Is that using standard 3.12.0 or the git version with PR 1741? |
Yeah, ruby 2.5.5 fixes it even with standard 3.12.0 puma branch 😄 (And I'm not sure about ruby 2.6 - I can't seem to reproduce the problem with 2.6, and am not sure which version it exists in exactly) |
Thanks again.
I don't recall any issues with Ruby 2.5.x < 2.5.4, it was only 2.5.4 that broke. Ruby trunk started failing on clustered shutdown/restart last year some time, so the patch was for compatibility with Ruby 2.6 and current trunk (2.7.0). |
Interesting... well when I ran it with Ruby 2.6.2, everything worked fine for me (with the standard 3.12.0 puma branch - did they fix it in 2.6.2?) |
PR #1747 updated the Travis matrix from 2.6.1 to 2.6.2, and it & trunk seem to be failing (2.5.5 is ok): |
Huh... I setup a docker-compose stack with ruby 2.6.2-p47 and puma 3.12.0 in clustered mode ( |
@guilleiguaran Can you give me more info about your macOS setup? I can't replicate the issue here. |
@atitan I need to get more information about your setup. Can you provide your config.rb and any info about your rails app? |
@evanphx Besides, if I don't preload the app, ActiveSupport constant will not be defined in My config looks like this
|
@atitan Sorry, still unable to reproduce it with an empty rails app. Can you send your Gemfile? |
Here you are.
|
Still unable to repro. Maybe can you push the rails app up to github and I can try it exactly as you have it? |
Here is what mine looks like:
|
@evanphx |
To sum up, reproducing the issue requires:
|
I can reproduce in a new rails app using the same configuration that @atitan described but I'm not able to reproduce under test conditions or using a bare rack app: # config.ru
run lambda { |env| [200, {'Content-Type'=>'text/plain'}, ["Hello Rack!"]] } # puma_config.rb
threads 4, 4
workers 2
environment "development"
preload_app! # Gemfile
source 'https://rubygems.org'
gem 'puma', github: 'puma/puma'
gem 'rack' |
This issue hasn't been touched in awhile, but I'm seeing the same issue (or very similar). Context:
I'm invoking Puma using
What I'm seeing now is that, if i do It seems like using Anyway, hopefully this helps. Happy to try out any potential fixes if need be. |
@greggilbert do you mind trying your repro with Puma from the master branch? related PR #1741 has been merged but not released yet |
I updated my Gemfile:
I ran This is interesting, though: when I rebuilt my Docker container, during the
And then when trying to run
Running |
Nice, can anyone see if #1674 (comment) still reproduces? |
I've had this problem for months (since updating to ruby 2.6) on my machine, running under the conditions in #1674 (comment). 3.12.1 does not fix the problem for me but I'm running my rails app on master now (with this in my gemfile: |
Closing as fixed on master b/c I agree. This will be in the next release after 3.12.1. |
Do you have plans for date of next release? Because the current stable version of |
Maintainers are meeting tomorrow, I would expect a release Soon (TM). |
I have a similar problem with puma 5.2.2 and ruby 2.7.1. Starting rails (6.0.3.6) with The problem does NOT appear, if I start the server using I tried with one worker and with two workers – same problem. What can I do to fix this? What is the odd thing that |
@morgler please start a new issue |
Steps to reproduce
Expected behavior
Actual behavior
Workers are already shut down, but the cluster master hanged on
Process.waitpid
.However, if I press ctrl+c after puma hanged , it terminated correctly.
System configuration
Operating System: macOS 10.14.1
Ruby version: 2.5.3
Rails version: 5.2.1
Puma version: 3.12.0
Bundle version: 1.16.6
The text was updated successfully, but these errors were encountered: