Skip to content

Add a server-side home-relay watchdog with in-process endpoint rebuild - #92

Merged
andrewchen5678 merged 3 commits into
mainfrom
server-relay-watchdog
Sep 4, 2026
Merged

andrewchen5678 merged 3 commits into
mainfrom
server-relay-watchdog

Conversation

@andrewchen5678

Copy link
Copy Markdown
Contributor

Summary

  • A custom-relay server is dialable from off the LAN only while it is registered on its home relay. iroh 1.0.3 was observed (networking LXC, relays behind Cloudflare tunnels) to silently lose that registration for good after a routine relay reconnect: no dial retries, no warnings, no registration on either relay. Relay-only clients (the iOS app, anything off the LAN) timed out until the service was restarted, while the mac desktop kept reconnecting over mDNS and hid the outage.
  • New transport::relay_watchdog watches Endpoint::home_relay_status(): after 60s without a connected home relay it nudges with network_change(); still none at 180s and the serve loop closes the endpoint, binds a fresh one with the same identity/allowlists (server_rebuild_factory), and serves on. Armed for custom relays only.
  • Bridge tasks are owned by the run they belong to (a JoinSet), so a rebuild never leaves them retrying on a closed endpoint; BridgeUpstream::run clears a stale connection slot on start.
  • The quick-mode idle timeout keeps being polled while a rebuild is retrying.
  • Version bumped to 0.0.70.

Test plan

  • ci/unix/ci.sh on Linux: clippy -D warnings + tests pass (5 new watchdog unit tests under paused tokio time)
  • After release: deploy 0.0.70 to the networking host and watch the journal for the watchdog's WARN/ERROR lines on the next relay loss; confirm the iOS client reconnects without a service restart

🤖 Generated with Claude Code

https://claude.ai/code/session_01C8wQiBCRQvGWxPKFu435YP

Andrew Chen and others added 3 commits September 3, 2026 20:20
A custom-relay server is dialable from off the LAN only while it is
registered on its home relay. iroh 1.0.3 has been observed to silently lose
that registration for good after a routine relay reconnect (relays behind
Cloudflare tunnels reset idle WebSockets roughly hourly): no dial retries, no
warnings, no registration on either relay. Relay-only clients — the iOS app,
anything off the LAN — then time out until the service is restarted, while
LAN clients that find the server over mDNS keep working and hide the outage.

The watchdog observes the endpoint's home-relay status and escalates like the
client's reconnect loop: after 60s without a connected home relay it nudges
the endpoint with `network_change()`; if there is still none at 180s the
serve loop closes the endpoint, binds a fresh one with the same identity and
allowlists, and serves on. Armed for custom relays only. Bridge tasks are now
owned by the run they belong to so a rebuild never leaves them retrying on a
closed endpoint.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01C8wQiBCRQvGWxPKFu435YP
The rebuild retry wait only polled the retry timer and the shutdown signal,
so a `server start --quick` whose rebuild kept failing would outlive its
5-minute grace. Poll the pinned grace future there too; nothing is bound
during that wait, so it returns without an endpoint close.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01C8wQiBCRQvGWxPKFu435YP
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01C8wQiBCRQvGWxPKFu435YP
@andrewchen5678
andrewchen5678 merged commit 8b8e17c into main Sep 4, 2026
4 checks passed
@andrewchen5678
andrewchen5678 deleted the server-relay-watchdog branch September 4, 2026 03:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant