Skip to content

fix(iroh): Reap ActiveRelayActor handles for idle relays #3249

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

Merged
merged 1 commit into from
Mar 27, 2025

Conversation

flub
Copy link
Contributor

@flub flub commented Mar 27, 2025

Description

The ActiveRelayActor exists when it is idle for a while (60s for now).
When it does the RelayActor is supposed to notice the tasks exists and
clean up the handles it keeps to all the ActiveRelayActors.
Unfortunately it was only doing this for ActiveRelayActors which
errored and not for those that exited normally because they were idle.

This makes sure to also reap active relay handles when the actor
exists normally.

Additionally this stops propagating the panic. The relay actor itself
is currently spawned without keeping track of the handle. Panicking
it would make it disappear silently. Propagating panics is
reasonable, but I don't want to fix the task spawning. That's for
another time.

Breaking Changes

Notes & open questions

I looked at writing a test for this, but testing the RelayActor is
still something that's difficult to do. So sadly no tests.

Change checklist

  • Self-review.

The ActiveRelayActor exists when it is idle for a while (60s for now).
When it does the RelayActor is supposed to notice the tasks exists and
clean up the handles it keeps to all the ActiveRelayActors.
Unfortunately it was only doing this for ActiveRelayActors which
errored and not for those that exited normally because they were idle.

This makes sure to also reap active relay handles when the actor
exists normally.

Additionally this stops propagating the panic.  The relay actor itself
is currently spawned without keeping track of the handle.  Panicking
it would make it disappear silently.  Propagating panics is
reasonable, but I don't want to fix the task spawning.  That's for
another time.
@flub flub requested review from dignifiedquire and ramfox March 27, 2025 12:48
Copy link

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

Last updated: 2025-03-27T12:50:41Z

Err(err) if err.is_cancelled() => {
error!("ActiveRelayActor cancelled: {err:#?}");
}
Err(err) => error!("ActiveRelayActor failed: {err:#?}"),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Look, aren't real rust matching semantics nice? The compiler told me I had a case that wasn't covered (ok, ok. The compiler is actually wrong because task errors are always either panics or cancelled, tokio doesn't allow anything else. But still, the compiler is right.)

Copy link

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: 1871304

@n0bot n0bot bot added this to iroh Mar 27, 2025
@github-project-automation github-project-automation bot moved this to 🏗 In progress in iroh Mar 27, 2025
Copy link
Contributor

@ramfox ramfox left a comment

Choose a reason for hiding this comment

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

oooo nice and insidious 🙌

@flub flub added this pull request to the merge queue Mar 27, 2025
Merged via the queue into main with commit 528a32c Mar 27, 2025
26 checks passed
@github-project-automation github-project-automation bot moved this from 🏗 In progress to ✅ Done in iroh Mar 27, 2025
@matheus23 matheus23 deleted the flub/relay-actor-reap branch March 28, 2025 09:32
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