Skip to content

Conversation

@shayonj
Copy link
Contributor

@shayonj shayonj commented Jul 27, 2017

This way, when you send SIGINT to a server, when running via
rails s, a graceful shutdown/stop will be performed.

Before this, not trapping SIGINT would mean that either Rails::Server#start
or ::Rack::Server#start would be trapping SIGINT and exiting the process.

Fix for: #1362

References:

Replication of current/fixed behavior:

rails s
=> Booting Puma
=> Rails 5.1.2 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
Puma starting in single mode...
* Version 3.9.1 (ruby 2.3.3-p222), codename: Private Caller
* Min threads: 5, max threads: 5
* Environment: development
* Listening on tcp://0.0.0.0:3000
Use Ctrl-C to stop
^C- Gracefully stopping, waiting for requests to finish
=== puma shutdown: 2017-07-26 19:53:48 -0700 ===
- Goodbye!
Exiting

log "*** SIGTERM not implemented, signal based gracefully stopping unavailable!"
end

begin
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code lower in this file

if Puma.jruby?
  Signal.trap("INT") do

move those two together

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

This way, when you send `SIGINT` to a running a server, when running via
`rails s`, a graceful shutdown/stop will be performed.

Before this, not trapping `SIGINT` would mean that either `Rails::Server#start`
or `::Rack::Server#start` would be trapping `SIGINT` and exiting the process.
@shayonj shayonj force-pushed the s/sigint-shutdown branch from 0507d34 to d9a2358 Compare August 5, 2017 22:23
@nateberkopec nateberkopec merged commit 8903eea into puma:master Aug 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants