Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Grace times can be too long for stop and restart #114

ryansch opened this Issue · 2 comments

2 participants


In developing another feature for bluepill I've been looking at the start_process, stop_process, and restart_process methods in Bluepill::Process. It seems to me that the grace time implementation doesn't work correctly in stop and restart mostly due to the use of execute_blocking.

Start (no issues)

If the user has requested bluepill to daemonize the process then this method will wait properly delay ticks as the System.daemonize method returns after double forking the daemon.

If the user is using a process that daemonizes itself, it should daemonize quickly at which point the start grace will still be correctly honored.


The same design pattern as start is used here. Most of the stop commands I've used and seen in use fall into two categories: send a signal and exit or instruct the process to shutdown and wait to make sure it did it.

This issue here is with stop commands that wait around for the process to shutdown. Bluepill will wait inside of System.execute_blocking while the stop command waits around for the process to terminate (and possibly clean up after it). As long as the stop command doesn't take longer than the stop_grace_time (correct behavior) we continue to the end of the method where we wait the entire stop_grace_time even though we may have waited nearly the entire time already in the worst case.


Again the same design pattern is used for restart. Restart exhibits the same issues as stop if the restart command has to wait for the process to stop for any reason before it can be started again (as opposed to sending a signal).


Feel free to send PRq. Currently I have no time to research bluepill, but will review PRq's (weekly).


Will do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.