-
Notifications
You must be signed in to change notification settings - Fork 188
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 panic when stopping the nats #10363
Conversation
@@ -44,6 +45,8 @@ func (n *NATSServer) ListenAndServe() (err error) { | |||
return nil | |||
} | |||
|
|||
// Shutdown stops the NATSServer gracefully | |||
// The NATS server itself runs the signal handling. Set `natsOpts.NoSigs = true` if you want to handle signals ourselves |
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.
I think we should use the natsOpts.NoSigs = true
option. The nats signal handler calls os.Exit() which might cause an unclean shutdown for the rest of ocis when running as a single binary.
I guess you'll have to add a n.server.WaitForShutdown() call below as well then.
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.
Good point!
60a3578
to
c1b9c72
Compare
@@ -44,6 +47,7 @@ func (n *NATSServer) ListenAndServe() (err error) { | |||
return nil | |||
} | |||
|
|||
// Shutdown stops the NATSServer gracefully | |||
func (n *NATSServer) Shutdown() { | |||
n.server.Shutdown() |
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.
I think you should add
n.server.WaitForShutdown()
here. (Similar to what the signal handler in nats does)
Quality Gate passedIssues Measures |
Fix panic when stopping the nats
Description
Related Issue
Motivation and Context
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Checklist: