Repository navigation
fix(devserver): close presumed-dead /rc connections via server-side keep-alive timeout - #24213
Conversation
|
Claude finished @dr1rrb's task in 3m 22s —— View job Code Review
SummaryVerdict: ship — the fix is correct and well-structured. One nit posted inline; test gap acknowledged below. What the change does well:
Findings:
Test gap (acknowledged in checklist): The unchecked test item is the right call to flag. The change is small enough that build + review suffices for now, but a regression test — one that injects a configurable timeout and verifies the connection scope is disposed when no frames arrive — would give durable protection. Happy to help author one if wanted. |
There was a problem hiding this comment.
Pull request overview
This PR fixes DevServer /rc connection leaks by adding a server-side receive watchdog: if no frames arrive for ~2.1× the keep-alive interval, the server presumes the peer is dead and exits the connection loop so the scoped workspace/session is disposed.
Changes:
- Centralizes the keep-alive cadence into
KeepAliveMessage.Intervaland reuses it in the client. - Adds a per-receive timeout in
RemoteControlServer.HandleConnectionAsyncto close silent/half-open connections. - Documents the shared interval and the server-side timeout rationale.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/Uno.UI.RemoteControl/RemoteControlClient.cs | Switches client keep-alive timer to use the shared KeepAliveMessage.Interval. |
| src/Uno.UI.RemoteControl/Messages/KeepAliveMessage.cs | Introduces shared Interval constant and documents its role across client/server. |
| src/Uno.UI.RemoteControl.ServerCore/RemoteControlServer.cs | Adds server-side receive timeout watchdog to reap presumed-dead connections. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-24213/wasm-skia-net9/index.html |
…eep-alive timeout The client already sends a KeepAliveMessage every 30s, but the server only answered pings; it never used their absence to detect a dead peer. A half-open /rc socket (client crash, network drop, or a reconnect that abandons the old socket) therefore kept its connection scope - and the hot-reload workspace it owns - alive indefinitely. The server now bounds each receive: if no frame arrives for more than KeepAliveTimeoutFactor (2.1) times the keep-alive interval, the connection is closed so its scope (and the workspace / EnC session) is disposed. The interval is defined once on KeepAliveMessage (the file is linked into both client and server) so the two ends cannot drift. The timeout is overridable via configuration so it can be regression-tested with a sub-second window. Fixes #24206
|
Thanks for the review — both points addressed (branch updated):
The branch was amended into a single clean commit. |
5dec90f to
6f057b7
Compare
|
Claude finished @dr1rrb's task in 3m 19s —— View job Code Review
SummaryVerdict: ship — the previous nit is addressed and the regression test has been added. What changed since the prior review:
Remaining observations (cosmetic, non-blocking):
Everything else — linked-source single source of truth for |
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-24213/wasm-skia-net9/index.html |
|
@Mergifyio backport release/stable/6.7 |
✅ Backports have been createdDetails
|
…6.7/pr-24213 fix(devserver): close presumed-dead /rc connections via server-side keep-alive timeout (backport #24213)
GitHub Issue: closes #24206
PR Type:
🐞 Bugfix
What changed? 🚀
Every connected client already sends a
KeepAliveMessageevery 30 s, but the server only ever answered pings — it never used their absence to notice a dead peer. A half-open/rcsocket (a client crash, a network drop, or a client that reconnected on a new socket without closing the old one) therefore kept its connection scope — and the hot-reload workspace / EnC session it owns (~hundreds of MB) — alive indefinitely (see #24206 / #24151).RemoteControlServer.HandleConnectionAsyncnow bounds each receive with a watchdog: if no frame arrives for more than 2.1× the keep-alive interval, the peer is presumed dead and the connection is torn down, so its scope (and the workspace it owns) is disposed instead of lingering. A healthy client pings every 30 s — well within the ~63 s window — so only silent / half-open connections are reaped.The interval is now defined once and shared, so the two ends can't drift:
KeepAliveMessage.Interval = TimeSpan.FromSeconds(30)— single source of truth.Messages/KeepAliveMessage.csis already<Compile Link>-ed intoUno.UI.RemoteControl.ServerCore, so client and server compile the exact same value (no new csproj plumbing).RemoteControlClient's keep-alive timer now readsKeepAliveMessage.Interval.RemoteControlServer.HandleConnectionAsync: per-receive timeout ofKeepAliveMessage.Interval * 2.1; on timeout it logs a warning and closes the connection (→ scope dispose →EndSession+ workspace dispose).PR Checklist ✅