You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Coder Connect tunnel not re-STUN'd on system wake; dead for minutes after macOS sleep #26736
After a macOS client sleeps and wakes, the Coder Connect tunnel to a workspace can stay unusable for several minutes. New dials fail with dial tcp [fd60:...]:22: i/o timeout until magicsock's periodic re-STUN re-homes the path on its own. VS Code Remote-SSH's resolver times out in that window and surfaces as "Reload Window" / UnparsableOutput.
Control plane healthy throughout (workspace/agent API calls return 200).
coder ssh proxy log: dial coder connect host "...:22" over tcp: i/o timeout on retries. The process was frozen mid-dial during sleep (~5 min wall-clock gap with no logs) and failed on wake.
By bundle-generation time the same path was direct p2p at 9 ms, so it recovered without intervention.
Root cause (coder/coder f66df86, coder/tailscale b7c5fc6)
Auto-recovery is wired and active:
wgengine/userspace.go:427 starts the netmon (e.netMon.Start(), unconditional).
:307 registers a change callback to linkChange().
linkChange() (:1126) calls magicConn.Rebind() on a major change and magicConn.ReSTUN() always.
This only fires on a netmon link-change event. macOS wake from a short same-network sleep often produces no such event, so linkChange never runs and recovery falls back to magicsock's slow periodic re-STUN. The daemon has no proactive wake trigger (vpn/tunnel.go:672's only sleep-aware code just reconciles deleted workspaces after reconnect).
Add a ManagerMessage_Wake case to vpn/tunnel.gohandleRPC that calls conn.Rebind().
Coder Desktop (macOS) subscribes to NSWorkspace.didWakeNotification (or IORegisterForSystemPower) and sends the RPC on wake.
This is an event-driven kick on a known OS event, not a health check. It forces re-discovery and never tears down a live tunnel.
Confirming
In Coder Desktop daemon net.wgengine logs around a wake, check for LinkChange: major, rebinding. Its absence at wake time confirms netmon is not firing.
Related: the Remote-SSH side of the same wake failure is microsoft/vscode-remote-release#11720 (local-server delayShutdown timer fires retroactively on macOS wake -> permanent UnparsableOutput).
They're complementary, and re-STUN here does not fix the sleep case alone: on wake the Remote-SSH timer fires at t≈0 (already-expired deadline) and the resolve is declared permanently dead before the re-STUN'd tunnel becomes dialable. Both are needed — #11720 keeps the resolve alive across the wake, and #26736 gets the tunnel dialable inside coder ssh's ~70s retry budget so the next dial succeeds. #26736 still independently helps the non-sleep cases (DERP flaps, network switches).
Activity
linear-code commentedon Jun 26, 2026
ENG-2970
EhabY commentedon Jun 28, 2026
Related: the Remote-SSH side of the same wake failure is microsoft/vscode-remote-release#11720 (local-server
delayShutdowntimer fires retroactively on macOS wake -> permanentUnparsableOutput).They're complementary, and re-STUN here does not fix the sleep case alone: on wake the Remote-SSH timer fires at t≈0 (already-expired deadline) and the resolve is declared permanently dead before the re-STUN'd tunnel becomes dialable. Both are needed — #11720 keeps the resolve alive across the wake, and #26736 gets the tunnel dialable inside
coder ssh's ~70s retry budget so the next dial succeeds. #26736 still independently helps the non-sleep cases (DERP flaps, network switches).fix: add VPN wake rebind hook (coder#26739)