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

wait for all connections to close before exiting on shutdown. #5322

Merged
merged 2 commits into from
Aug 2, 2018

Conversation

Stebalien
Copy link
Member

Using httpServer.Shutdown will:

  1. Close the listener (preventing new connections).
  2. Close each connection as outstanding requests finish.

Turns out this issue wasn't as tricky as I had thought.

This prevent us from shutting down before outstanding requests get a chance to respond.

fixes #4055

License: MIT
Signed-off-by: Steven Allen <[email protected]>
Using httpServer.Shutdown will:

1. Close the listener (preventing new connections).
2. Close each connection as outstanding requests finish.

This prevent us from shutting down before outstanding requests get a chance to
respond.

fixes #4055

License: MIT
Signed-off-by: Steven Allen <[email protected]>
@Stebalien Stebalien requested a review from Kubuxu as a code owner July 31, 2018 20:08
@ghost ghost assigned Stebalien Jul 31, 2018
@ghost ghost added the status/in-progress In progress label Jul 31, 2018
@Stebalien Stebalien requested a review from magik6k July 31, 2018 20:08
"gx/ipfs/QmdE4gMduCKCGAcczM2F5ioYDfdeKuPix138wrES1YSr7f/go-ipfs-cmdkit"

cmds "github.com/ipfs/go-ipfs/commands"
)

var daemonShutdownCmd = &cmds.Command{
Helptext: cmdkit.HelpText{
Tagline: "Shut down the ipfs daemon",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe Schedule shutdown of the ipfs daemon?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, it does shut it down. This will:

  1. Cancel in-progress requests.
  2. Wait for the IPFS node to close.
  3. Return.

Note: it won't actually wait for all in-progress requests to finish. That would deadlock.

@Kubuxu Kubuxu added RFM and removed status/in-progress In progress labels Aug 2, 2018
@Stebalien Stebalien merged commit 00c422f into master Aug 2, 2018
@Stebalien Stebalien deleted the fix/shutdown-error branch August 2, 2018 21:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error message when shutting down ipfs daemon
3 participants