-
Notifications
You must be signed in to change notification settings - Fork 950
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
bugfix: make the daemon exit happy #1311
bugfix: make the daemon exit happy #1311
Conversation
When the daemon server fails, the process will be hang because the no-one closes the channel. We should exit. Signed-off-by: Wei Fu <fhfuwei@163.com>
Codecov Report
@@ Coverage Diff @@
## master #1311 +/- ##
=======================================
Coverage 16.42% 16.42%
=======================================
Files 183 183
Lines 11309 11309
=======================================
Hits 1857 1857
Misses 9316 9316
Partials 136 136 |
|
||
os.Exit(1) | ||
case err := <-errCh: | ||
// FIXME: should we do the cleanup like signal handle? |
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 also should do cleanup when daemon exited.
I do not know if this case will happen: pouchd panic and return error, then we should make the daemon exit gracefully. WDYT ?
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.
Agree. But for now, we should hold the scope like @rudyfly said. Refactor the code in the following PR. WDYT?
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.
Confirm with @HusterWan , let us add TODO here.
LGTM, and add TODO when server cause error, what to do cleanup. |
When the daemon server fails, the process will be hang because the
no-one closes the channel. We should exit.
Signed-off-by: Wei Fu fhfuwei@163.com
Ⅰ. Describe what this PR did
Make the daemon exit happy.
Ⅱ. Does this pull request fix one issue?
NONE
Ⅲ. Describe how you did it
Basically, we should run the daemon main in new goroutine and wait for it to exit. Based on this, we can receive the signal and clean it up.
Ⅳ. Describe how to verify it
Use available port and it should be success.
Use used port and it should be fail
Ⅴ. Special notes for reviews
@allencloud , @HusterWan and @rudyfly
Should we need to clean it up like
sigHandle
when we receive error fromRun()
?cc @shaloulcy