-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[FIXED] #4789 to allow a restart of a shutdown server instance. #4792
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Derek Collison <[email protected]>
@@ -2083,6 +2083,11 @@ func (s *Server) Start() { | |||
|
|||
defer s.Noticef("Server is ready") | |||
|
|||
// Check is this may be a restart. | |||
if s.startupComplete == nil { |
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 one should ask if we want to support calling s.Start() after a s.Shutdown(). If yes, then I think it is a bit more than that, that needs to be done. I believe that there are others things that are created/setup in NewServer() whose state may be changed during Shutdown() and that Start() will not take into account.
s.Shutdown() | ||
s.WaitForShutdown() | ||
s.Start() | ||
defer s.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.
Case in point, would s.Shutdown() not panic because channel shutdownComplete
has already been closed in previous Shutdown()? My point is that I believe that there way more state that would need to be recreated/reset on a Start() after a Shutdown() that we can think of.
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.
If it does not panic, it means that the second Shutdown() is actually not shutting down, likely because the code thinks it is already 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.
Meaning we should expand the test to make sure the server is usable? Or are you suggesting that the second start should fail and you can not re-use servers that have been 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.
The latter. I think that there is a lot of "state" that would need to be recreated/reset if we wanted to support a Start() after a Shutdown() (and therefore subsequent Shutdown() calls..). The only issue I have with that is Start() does not return an error, so that would leave the user not knowing that it is not started again. We could add a StartServer() or something like that, that would return an error (similar to what we did with NewServer vs New).
Resolves: #4789
Signed-off-by: Derek Collison [email protected]