Skip to content

fix: stop polling transports when the magicsock is closing#3615

Merged
Frando merged 1 commit intomainfrom
Frando/relay-close-fix
Nov 6, 2025
Merged

fix: stop polling transports when the magicsock is closing#3615
Frando merged 1 commit intomainfrom
Frando/relay-close-fix

Conversation

@Frando
Copy link
Copy Markdown
Member

@Frando Frando commented Nov 6, 2025

Description

Since we merged #3601 we sometimes get ugly (but harmless) error log messages when the endpoint is shutting down:

2025-11-06T11:28:26.721826Z ERROR ep-client:client: iroh::magicsock::transports::relay: relay_recv_channel closed
2025-11-06T11:28:26.721884Z ERROR ep-client:client: iroh_quinn::endpoint: I/O error: connection closed

This fixes it: We already have a check in the transports to return Pending without polling the actual transports once Magicsock::is_closed is true. This PR changes it to instead check Magicsock::is_closing. The latter is set after Endpoint::wait_idle completed, but before cancelling the actor and transport tasks. Whereas is_closed is set after the actor and transport tasks are fully shutdown. When Endpoint::wait_idle completes, we do not expect the quinn endpoint to do anything meaningful, so it is fine to stop polling the transports at this time, and thus not get errors from the transports into quinn if they fail (because they are shutting down).

Breaking Changes

Notes & open questions

Change checklist

  • Self-review.
  • Documentation updates following the style guide, if relevant.
  • Tests if relevant.
  • All breaking changes documented.
    • List all breaking changes in the above "Breaking Changes" section.
    • Open an issue or PR on any number0 repos that are affected by this breaking change. Give guidance on how the updates should be handled or do the actual updates themselves. The major ones are:

@github-actions
Copy link
Copy Markdown

github-actions bot commented Nov 6, 2025

Documentation for this PR has been generated and is available at: https://n0-computer.github.io/iroh/pr/3615/docs/iroh/

Last updated: 2025-11-06T11:53:22Z

@Frando Frando requested review from dignifiedquire and flub and removed request for flub November 6, 2025 11:55
Copy link
Copy Markdown
Contributor

@flub flub left a comment

Choose a reason for hiding this comment

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

A separate question is why MagicSock has both is_closing and is_closed. But this makes sense, thanks!

@github-actions
Copy link
Copy Markdown

github-actions bot commented Nov 6, 2025

Netsim report & logs for this PR have been generated and is available at: LOGS
This report will remain available for 3 days.

Last updated for commit: 0d05ec3

@Frando
Copy link
Copy Markdown
Member Author

Frando commented Nov 6, 2025

A separate question is why MagicSock has both is_closing and is_closed. But this makes sense, thanks!

Yeah, I was tempted to clean up the closing variables a bit further, but will leave that to a separate PR.

@n0bot n0bot bot added this to iroh Nov 6, 2025
@github-project-automation github-project-automation bot moved this to 🏗 In progress in iroh Nov 6, 2025
@Frando Frando added this pull request to the merge queue Nov 6, 2025
Merged via the queue into main with commit e101d26 Nov 6, 2025
30 checks passed
@github-project-automation github-project-automation bot moved this from 🏗 In progress to ✅ Done in iroh Nov 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

2 participants