roller
roller copied to clipboard
ServiceConfig kills services like DA on stop
Roller version
latest
OS
Desn't matter
Processor Architecture
Doesn't matter either
Others
No response
Steps to reproduce it
roller run
and then Ctrl+C
Expected result
I expect services/sub-processes to be not killed but gracefully shut down.
Actual result
DA process is killed. This is bad because there are a bunch of things the process has to do on stop, like flush unwritten buffers or send certain p2p messages.
Relevant log output
No response
Notes
In general, the current design of ServiceConfig
and its interaction with run
command and the DA interface do not consider graceful shutdown, and making it work would require refactoring. The simplest thing, though, could be changing the Cancel
func on the CommandContext
field here to send an interrupt signal to subprocess. The proper fix would be waiting for all the services to finish(cmd.Run) with some form of WaitGroup in the run
cmd. Idiomatically, you would also need to make it so it respects context cancellation and still kills the process after a timeout, like in https://github.com/golang/go/blob/cacac8bdc5c93e7bc71df71981fdf32dded017bf/src/cmd/go/script_test.go#L1091-L1098