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

Graceful shutdown of node #736

Closed
flub opened this issue Jan 30, 2023 · 6 comments · Fixed by #2227
Closed

Graceful shutdown of node #736

flub opened this issue Jan 30, 2023 · 6 comments · Fixed by #2227
Assignees
Labels
_c-iroh-legacy Formerly big iroh node with all protocols feat New feature or request

Comments

@flub
Copy link
Contributor

flub commented Jan 30, 2023

Provider should be able to be requested to be shut down. At this point it should stop accepting new connections but continue any current transfer. A timeout for continuing the existing transfer is not needed, if that takes to long a hard abort by the user is fine.

@dignifiedquire dignifiedquire self-assigned this Feb 2, 2023
dignifiedquire referenced this issue in n0-computer/sendme-legacy Feb 2, 2023
This stops accepting new connections, but does not currently abort transfers.

Closes #77
dignifiedquire referenced this issue in n0-computer/sendme-legacy Feb 3, 2023
This stops accepting new connections, but does not currently abort transfers.

Closes #77
dignifiedquire referenced this issue in n0-computer/sendme-legacy Feb 3, 2023
This stops accepting new connections, but does not currently abort transfers.

Closes #77
@flub flub assigned flub and unassigned dignifiedquire Feb 6, 2023
@flub
Copy link
Contributor Author

flub commented Feb 6, 2023

We'll attempt to replace this with something more minimal. Only purpose is to have a method that can make the task stop without a JoinError. Nothing more graceful about it.

flub referenced this issue in n0-computer/sendme-legacy Feb 7, 2023
This adds Provider::shutdown allowing to stop the Provider without
having to abort it.  On the wire however it still does not do anything
graceful: all the connections are stopped and any in-transit data is
lost.

Additionally this adds tracing spans to the connection handling.

Finally it fixes a bug where read_lp would not return None if the
connection was closed normally.

Part of #77 but this is not very graceful on the wire yet.
@flub
Copy link
Contributor Author

flub commented Feb 13, 2023

Leaving this issue open, but concerning the v0.1.0 milestone this is done.

@dignifiedquire dignifiedquire transferred this issue from n0-computer/sendme-legacy Feb 20, 2023
@ramfox ramfox added this to iroh Feb 21, 2023
@github-project-automation github-project-automation bot moved this to 📋 Backlog - unassigned issues in iroh Feb 21, 2023
@ramfox ramfox moved this from 📋 Backlog - unassigned issues to 🔖 Ready - assigned issues in iroh Feb 21, 2023
@flub
Copy link
Contributor Author

flub commented Jun 12, 2023

moving milestone, this is not really relevant right now

@dignifiedquire dignifiedquire changed the title Graceful shutdown of provider Graceful shutdown of node Jul 6, 2023
@dignifiedquire dignifiedquire added the _c-iroh-legacy Formerly big iroh node with all protocols label Jul 6, 2023
@b5 b5 moved this from 🔖 Ready to 📋 Backlog in iroh Oct 2, 2023
@dignifiedquire
Copy link
Contributor

@flub how much more work is left here in your opinion?

@dignifiedquire dignifiedquire added the feat New feature or request label Oct 18, 2023
@flub
Copy link
Contributor Author

flub commented Oct 19, 2023

I'm not sure how much all the current refactoring has changed things, so rebasing might be a bit tricky by now. But this is what is needed:

  • magicsocket should not be shut down when magicendpoint's close is called. It should stay alive until the quinn endpoint driver is done with it (this endpoint driver runs in a spawned and detached tokio task) at which point it will drop the magicsocket.
  • When dropped magicsocket should not stop, instead it should enter a draining state just like a socket from the kernel does. When you send something to a real socket once it's accepted it won't be dropped. We need to do the same. So once magicsock is dropped it must refuse to accept any other sends, must refuse to receive anything or pass on anything received (that's easy, poll_recv is not going to be called anymore); but crucially it must still attempt to send all the things in the send buffers.
  • Once drained, magicsocket can finally be deallocated.

In my old PR I have the first point done, not the rest. This will probably need some changes now that there have been so much refactoring on the send and receive path.

I'm guessing this is like 3ish days work?

@ramfox ramfox moved this from 📋 Backlog to 🔖 Ready in iroh Feb 6, 2024
@ramfox ramfox added this to the v0.13.0 milestone Feb 6, 2024
@dignifiedquire dignifiedquire modified the milestones: v0.13.0, v0.14.0 Feb 12, 2024
@flub flub assigned divagant-martian and unassigned flub Mar 12, 2024
@ramfox ramfox moved this to 📋 Backlog in iroh Apr 10, 2024
@ramfox ramfox moved this from 📋 Backlog to 🏗 In progress in iroh Apr 11, 2024
@divagant-martian divagant-martian moved this from 🏗 In progress to 📋 Backlog in iroh Apr 14, 2024
@divagant-martian divagant-martian removed this from the v0.14.0 milestone Apr 14, 2024
@flub
Copy link
Contributor Author

flub commented Apr 23, 2024

There is also #2198, which is a duplicate of this I think.

@divagant-martian divagant-martian linked a pull request Apr 23, 2024 that will close this issue
4 tasks
@github-project-automation github-project-automation bot moved this from 📋 Backlog to ✅ Done in iroh Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
_c-iroh-legacy Formerly big iroh node with all protocols feat New feature or request
Projects
Archived in project
Status: Done
4 participants