-
Notifications
You must be signed in to change notification settings - Fork 334
refactor(iroh): Spawn RemoteStateActor in JoinSet and remove guarded_channel.rs
#3681
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
base: main
Are you sure you want to change the base?
Conversation
5c66034 to
de05f27
Compare
|
Documentation for this PR has been generated and is available at: https://n0-computer.github.io/iroh/pr/3681/docs/iroh/ Last updated: 2026-01-05T16:50:01Z |
de05f27 to
4c4d11d
Compare
|
This PR has the problem that we only run the Also: The |
|
This would still be nice to have, please don't forget about it. |
6e09bda to
f9c98d1
Compare
f9c98d1 to
15cbd59
Compare
This is actually not possible. Calls to |
Also: Make sure to always acquire locks in the same order to avoid deadlocks, and also avoid reentrant locking.
| "oops, flub didn't think this would happen"); | ||
| } | ||
|
|
||
| let sender = self.msock.remote_map.remote_state_actor(node_id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was starting the RemoteStateActor if it's not running, whereas the new try_send only sends to running actors. Is this change intended?
Edit: Right, I think it's fine because sending to a just-spawned actor is a noop anyways.
| /// The state kept for spawning new tasks for remote state actors and cleaning them up. | ||
| /// | ||
| /// The lock for this needs to be acquired *after* the lock for the `actor_senders` is acquired. | ||
| actor_tasks: Mutex<Tasks>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not put the senders and the tasks in the same mutex, to avoid the deadlock risk?

Description
Depends on n0-computer/n0-future#23 for
JoinSet::poll_join_nextandJoinError::try_into_panic.guarded_channel.rsRemoteMap, which will immediately spawn a newRemoteStateActorin case it missed some messages during shutdown.RemoteStateActorin aJoinSetthat's held in aMutexinside theRemoteMap(effectively owned by the magic socket).Notes & open questions
I think it's good to look at this right now, but some considerations/TODOs:
RemoteMap. Maybe only themagicsock::Actorshould own theJoinSet, and theRemoteMapshouldn't actually store it itself.RemoteStateActor::runis the right way to do this.Change checklist