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
DevServer: server-side WebSocket keepalive/timeout on /rc to reap half-open connections #24206
The server connection loop (RemoteControlServer.HandleConnectionAsync) only exits when ReceiveAsync returns null/throws. There is no server-side WebSocket keepalive (app.UseWebSockets() is configured without KeepAliveInterval). Keep-alive/ping messages exist in the protocol, but the server side does not use them to detect a dead peer.
Consequence: if an app dies without a clean TCP close (hard crash, network drop, or a client reconnect that abandons the old socket), the old /rc connection stays "open" server-side → its workspace + DebuggingSession (~500 MB) linger indefinitely, coexisting with the new connection's workspace. Measured: two concurrent connections = two workspaces (~1.35 GB), zero Disposing connection.
Proposal: enable server-side WebSocket keepalive with a timeout (or an application-level ping deadline using the existing KeepAlive messages), and dispose the connection scope (→ EndSession + workspace dispose) when a peer stops responding. This reaps orphaned workspaces with no active kill and no risk of a reconnect storm.
Verified on Uno.WinUI.DevServer 6.8.0-dev.159 (Uno.Sdk 6.8.0-dev.39), Windows, net10.0-desktop. Partially
fixed — the keepalive lands, the workspace reclaim does not.
Fixed:RemoteControlServer.HandleConnectionAsync now bounds every receive with receiveCts.CancelAfter(keepAliveTimeout), where ResolveKeepAliveTimeout() = uno-devserver:keep-alive-timeout-ms
if set, else KeepAliveMessage.Interval (30s) × 2.1 = 63 s.
Tested against a real half-open socket (NtSuspendProcess on a connected app — TCP stays established, client stops
pinging):
default: connection closed 63 s after the last ping (lifetime 94.6 s), then Disposing connection + Unloading assembly context UnoApp1
--uno-devserver:keep-alive-timeout-ms=15000: lifetime drops to 17–20 s
Deadline is causal, config knob works, and the "zero Disposing connection" symptom is gone.
Not fixed: the ticket also expects the scope disposal to give "EndSession + workspace dispose" and to "reap
orphaned workspaces". EndSession happens; the workspace dispose doesn't. gcroot on a dump taken right after the
reap (single app, single workspace):
type
instances
rooted
EditAndContinue.DebuggingSession
1
0 roots ✅
MSBuild.MSBuildWorkspace
1
still rooted ❌
ServerHotReloadProcessor
1
still rooted
Uno.HotReload.HotReloadManager
1
still rooted
Host RSS stayed at 565 MB. (RSS alone proves nothing here — the host runs workstation GC with HeapHardLimitPercent: 66, so nothing decommits on an idle machine; hence gcroot.)
Activity
fix(devserver): close presumed-dead /rc connections via server-side k…
khaskoul commentedon Sep 14, 2026
Verified on
Uno.WinUI.DevServer6.8.0-dev.159 (Uno.Sdk 6.8.0-dev.39), Windows,net10.0-desktop. Partiallyfixed — the keepalive lands, the workspace reclaim does not.
Fixed:
RemoteControlServer.HandleConnectionAsyncnow bounds every receive withreceiveCts.CancelAfter(keepAliveTimeout), whereResolveKeepAliveTimeout()=uno-devserver:keep-alive-timeout-msif set, else
KeepAliveMessage.Interval (30s) × 2.1= 63 s.Tested against a real half-open socket (
NtSuspendProcesson a connected app — TCP stays established, client stopspinging):
Disposing connection+Unloading assembly context UnoApp1--uno-devserver:keep-alive-timeout-ms=15000: lifetime drops to 17–20 sDeadline is causal, config knob works, and the "zero
Disposing connection" symptom is gone.Not fixed: the ticket also expects the scope disposal to give "
EndSession+ workspace dispose" and to "reaporphaned workspaces".
EndSessionhappens; the workspace dispose doesn't.gcrooton a dump taken right after thereap (single app, single workspace):
EditAndContinue.DebuggingSessionMSBuild.MSBuildWorkspaceServerHotReloadProcessorUno.HotReload.HotReloadManagerHost RSS stayed at 565 MB. (RSS alone proves nothing here — the host runs workstation GC with
HeapHardLimitPercent: 66, so nothing decommits on an idle machine; hencegcroot.)Two causes:
ServerHotReloadProcessor.Dispose()cancels but never drops the reference —_workspace?.Ct.Cancel();with no_workspace = null. CompareDisableHotReloadAsync(the fix(devserver): cap concurrent hot-reload workspaces, disable oldest without closing the socket #24240 cap path), which does null it, and whose workspaces Imeasured as genuinely unrooted.
AssemblyLoadContext (held by Roslyn MEF DefaultAnalyzerService -> AnalyzerAssemblyLoader)
-> Func<ALC, AssemblyName, Assembly> (Resolving handler, never unsubscribed)
-> DefaultRemoteControlProcessorFactory
-> ServiceProviderEngineScope (the "disposed" connection scope)
-> RemoteControlServer -> ServerHotReloadProcessor -> HotReloadManager -> MSBuildWorkspace
Jen-Uno commentedon Sep 30, 2026
QA: closing out without a manual pass. The fix in #24213 ships with automated tests (
Given_KeepAliveTimeout.cs) that exercise the change.If you still see this behaviour on a build that includes that PR, please reopen or comment here.