-
Notifications
You must be signed in to change notification settings - Fork 188
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
Ctrl-C doesn't stop puma and SIGTERM does not work #1951
Comments
Thank you for the report. Could you try sending SIGALRM ( If running in |
This is the backtrace I got:
|
Thanks, I'll try to reproduce with a fresh Rails 6 app in dev mode with listen, nio4r and rack-mini-profiler. |
I can reproduce with the setup in #1962 (comment) |
It seems quite a few gems are competing for overriding the handler for SIGINT (with
So the Puma one wins (and doesn't use the previous handlers), but it doesn't seem to work as expected. |
It's getting stuck when the Puma server thread is waiting for the Puma reactor thread, which seems stuck in
Using |
The issue is that |
That code is from Rubinius. FWIW it seems this was fixed in Rubinius by removing buffering (IO::InternalBuffer) entirely in rubinius/rubinius@a8f23c1 |
Replacing https://github.com/puma/puma/blob/4f555a18c1d9c81d89fc715e96434359afee02a3/lib/puma/reactor.rb#L160 in Puma with |
A snippet to reproduce the buffering issue, which also shows the problem on MRI when a read buffer is used: require 'nio'
r, w = IO.pipe
# r.sync = false
selector = NIO::Selector.new
selector.register(r, :r)
w.write "pre\n"
w.write "a"
w.write "b"
p r.gets # causes buffering to be used, also reads a and b in the buffer
p IO.select([r]) # IO.select knows to look inside the buffer
p selector.select(3) # but epoll does not!
p r.read(1) |
I've got a fix for this, testing it in CI, it quits nicely now. |
Truffleruby version (happens on native with or without JIT too)
Start command:
Once the server finally starts, CPU is pegged at about 400% for a few minutes and then drops to ~100% for another few minutes.
Pressing Ctrl-C does nothing--even when pressed multiple times:
- Gracefully stopping, waiting for requests to finish
appears when I didkill 49851
. the last line appeared when I didkill -9 49851
.I have not (yet) spent the time to create a minimally reproducible case
The text was updated successfully, but these errors were encountered: