You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.1-p112), 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-10 20:45:22 -0700 ===
- Goodbye!
Notice, its gracefully stopping and logs shutdown timestamp.
Actual 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.1-p112), codename: Private Caller
* Min threads: 5, max threads: 5
* Environment: development
* Listening on tcp://0.0.0.0:3000
Use Ctrl-C to stop
^CExiting
puma
Puma starting in single mode...
* Version 3.9.1 (ruby 2.3.1-p112), 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-10 20:47:45 -0700 ===
- Goodbye!
So, to better handle SIGINT / ctrl + c, does introducing a .shutdown function to Rack::Handler::Puma, which would restore this signal and then kill the process sound like a better workaround?
I can see an argument being made that this implementation is very specific to support Rack's requirement of a server instance having a shutdown function. But, given this may live in Rack::Handler::Puma, it still makes sense to me. Please, let me know if I am missing something :).
The text was updated successfully, but these errors were encountered:
shayonj
changed the title
SIGINT or Ctrl+c have different outcomes when starting server via puma and rails s
SIGINT or Ctrl+c have different outcomes when stopping server being run via puma and rails s
Jul 11, 2017
Steps to reproduce
Clone a simple/barebones rails app: https://github.com/shayonj/test-repro-app
rails s
ctrl + c
Expected behavior
Notice, its gracefully stopping and logs shutdown timestamp.
Actual behavior
Perhaps, no graceful stop/exit?
System configuration
Ruby version:
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin16]
Rails version:
Rails 5.1.2
Further info
The graceful stop/exit, works fine from the cli version. For example:
Clone a simple/barebones rails app: https://github.com/shayonj/test-repro-app
puma
ctrl + c
Proposal
This is something, I came across when working on #1183. After digging a little deeper, it appears
Rails::Server
inherits fromRack::Server
, which trapsSIGINT
signal andexit
s when noshutdown
function is found.So, to better handle
SIGINT
/ ctrl + c, does introducing a.shutdown
function toRack::Handler::Puma
, which would restore this signal and then kill the process sound like a better workaround?Ex:
I can see an argument being made that this implementation is very specific to support Rack's requirement of a server instance having a
shutdown
function. But, given this may live inRack::Handler::Puma
, it still makes sense to me. Please, let me know if I am missing something :).The text was updated successfully, but these errors were encountered: