Repository navigation
Exit non-zero when a server fails to start - #418
Merged
Merged
Conversation
The chunk and index servers printed the error from ListenAndServe to stderr and then returned nil, so a server that never came up exited with status 0. Supervisors and CI read that as a clean shutdown. Hand the error back to the caller instead, and keep returning nil when the context is cancelled, which is how a signal shuts the server down.
The derived context only existed to merge the two ways serve() can finish. A select on the error channel and the caller's context does that directly, so the context, its cancel and the second, non-blocking select all go.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The chunk and index servers printed the error from
ListenAndServeto stderr and then returned nil, so a server that never came up exited with status 0.desync chunk-server -s store -l 127.0.0.1:1reportedbind: permission deniedand exited 0, which supervisors and CI read as a clean shutdown.The error is now handed back to the caller so cobra reports it and the process exits 1. Shutting down because the context was cancelled, which is what a signal does, still returns nil.