-
Notifications
You must be signed in to change notification settings - Fork 379
Description
Summary
After an iroh::Endpoint has been running for a while, the swarm-discovery receiver actor enters a tight loop logging DEBUG "dropping message due to closed mailbox" every ~12 ms for every incoming mDNS packet. The messages come from acto::tokio::TokioSender::send and never stop until the process exits.
Root cause
Two issues combine:
1. iroh discards the DropGuard (iroh side)
In MdnsAddressLookup::spawn_discoverer() (src/address_lookup/mdns.rs), the DropGuard returned by Discoverer::spawn() is not stored — only the iroh-side actor AbortOnDropHandle is kept:
// spawn_discoverer() — simplified
let guard = discoverer.spawn(rt)?; // DropGuard returned here
// … guard is dropped at the end of this scopeWhen the DropGuard drops, it aborts the guardian actor, which eventually tears down the sender actor. But the receiver actors are left running because their UDP sockets are still alive.
2. Receiver ignores failed sends (swarm-discovery side)
In swarm-discovery/src/receiver.rs:
loop {
let (len, addr) = socket.recv_from(&mut buf).await?;
if let Some(msg) = handle_msg(msg, &service_name, addr.ip()) {
target.send(msg); // returns false when target is dead — ignored
}
}The receiver never checks the return value of target.send(). Once the sender actor is dead, every mDNS packet produces a failed send + a DEBUG log line from acto, indefinitely.
Reproduction
On any LAN with mDNS traffic (typical macOS/Linux desktop), create an endpoint with mDNS discovery enabled and observe logs at DEBUG level. The spam starts within seconds after the DropGuard is dropped.
Observed log output
22:52:56.955 DEBUG dropping message due to closed mailbox
22:52:56.967 DEBUG dropping message due to closed mailbox
22:52:56.978 DEBUG dropping message due to closed mailbox
… (repeats every ~12 ms indefinitely)
Suggested fix
iroh: Store the DropGuard as a field in MdnsAddressLookup so the swarm-discovery runtime stays alive as long as the endpoint does.
swarm-discovery (secondary): The receiver should check target.send() and exit the loop when it returns false, so a dead target doesn't cause unbounded log spam.
Versions
- iroh 0.97.0
- swarm-discovery 0.5.0
- acto 0.8.0
Metadata
Metadata
Assignees
Labels
Type
Projects
Status