Skip to content
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

Merged
merged 1 commit into from
May 15, 2018
Merged

bugfix: make the daemon exit happy #1311

merged 1 commit into from
May 15, 2018

Conversation

fuweid
Copy link
Contributor

@fuweid fuweid commented May 14, 2018

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.

pouchd --listen tcp://localhost:5000 --debug

Use used port and it should be fail

python -m SimpleHTTPServer 5000 &
pouchd --listen tcp://localhost:5000 --debug

Ⅴ. Special notes for reviews

@allencloud , @HusterWan and @rudyfly

Should we need to clean it up like sigHandle when we receive error from Run()?

cc @shaloulcy

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>
@pouchrobot pouchrobot added kind/bug This is bug report for project size/M labels May 14, 2018
@fuweid fuweid requested review from allencloud, HusterWan, rudyfly and shaloulcy and removed request for allencloud and HusterWan May 14, 2018 06:04
@codecov-io
Copy link

Codecov Report

Merging #1311 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           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?
Copy link
Contributor

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 ?

Copy link
Contributor Author

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?

Copy link
Contributor Author

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.

@rudyfly
Copy link
Collaborator

rudyfly commented May 14, 2018

LGTM, and add TODO when server cause error, what to do cleanup.

@pouchrobot pouchrobot added the LGTM one maintainer or community participant agrees to merge the pull reuqest. label May 14, 2018
@fuweid fuweid merged commit 48575a9 into AliyunContainerService:master May 15, 2018
@fuweid fuweid deleted the bugfix_make_exit_happy branch May 15, 2018 02:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug This is bug report for project LGTM one maintainer or community participant agrees to merge the pull reuqest. size/M
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants