-
Notifications
You must be signed in to change notification settings - Fork 337
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
fix: gracefully suspend bee node on interrupt signal #3671
Conversation
cmd/bee/cmd/start.go
Outdated
}, | ||
stop: func() { | ||
// Shutdown | ||
// Whenever program is being stoppend we need to close |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo in stoppend
The interrupt signal still does not work when batch synchronization is in progress. Also when a node is waiting to be funded. |
cmd/bee/cmd/start.go
Outdated
select { | ||
case <-sysInterruptChannel: | ||
logger.Debug("received interrupt signal") | ||
case <-time.After(shutdownTimeout): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not correct. Adding a hard-coded timeout is not the right thing to do. There could be valid cases when the node takes more than 5 secs to stop.
As the comment said, the correct way to handle this is to check for a second interrupt signal to force stop if user does not have the patience. I am not sure if this can be done using context cancellation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work. This looks good. Can you manually test the following scenarios, as we dont have proper unit tests in this package.
- Ctrl-C waiting for the chequebook deployment
- Ctrl-C while postage sync is running
- Ideally we should test if Ctrl-C also works during bootstrapping. But right now we have not yet updated the postage snapshot feed. When we do, we should test this.
- Randomly try to do Ctrl-C during different times. Also trying this after node warmup period (5mins) is done.
@aloknerurkar I have manually testes all those scenarios. However there could be some issue if some logic is not responding to context cancelation signal. This would be hard to catch on this level; instead it should be covered/tested in respective package. |
Checklist
Description
Closes: #3660
This change is![Reviewable](https://camo.githubusercontent.com/23b05f5fb48215c989e92cc44cf6512512d083132bd3daf689867c8d9d386888/68747470733a2f2f72657669657761626c652e696f2f7265766965775f627574746f6e2e737667)