Skip to content

DevServer: cap concurrent app Hot Reload workspaces; disable HR on oldest beyond N without closing the socket #24205

Closed

Description

@dr1rrb

Follow-up from the investigation on #24151.

Each /rc app connection gets its own DI scope → its own RemoteControlServer + MSBuild workspace + EnC DebuggingSession ≈ +330–900 MB each. Measured: host 108 MB → 439 MB after 1 app → 1348 MB after 2 apps, with nothing disposed. There is no cap.

If an agent restarts an app in a loop, or a crash/half-open socket leaves a previous connection alive, workspaces stack and memory explodes.

Proposal: cap the number of active app Hot Reload workspaces (e.g. ~5). Beyond the cap, disable HR for the oldest app(s) — i.e. dispose their workspace / DebuggingSession to reclaim the ~500 MB — without closing the /rc socket (closing it would trigger the client's auto-retry → reconnect storm). Re-arm the workspace if that app becomes active again. Workspace lifetime is independent from the socket, so this is feasible.

Related: #24151 companion issues on server-side keepalive (reaping half-open sockets) and per-solution/baseline/target workspace sharing.

Activity

  1. added theissue type on Sep 11, 2026
  2. khaskoul commented on Sep 14, 2026

    @khaskoul

    Verified fixed on Uno.WinUI.DevServer 6.8.0-dev.159 (Uno.Sdk 6.8.0-dev.39), Windows, desktop head.

    Launched up to 10 concurrent app connections against a standalone DevServer host:

    apps host WS event
    1 565 MB
    5 2043 MB ~370 MB/app
    6 2402 MB cap fired
    8 2784 MB cap fired
    10 3462 MB cap fired

    HotReloadWorkspaceRegistry caps at 5 (DefaultMaxConcurrentWorkspaces), evicts the oldest, and logs:

    Hot reload disabled for this connection: …reached its concurrent hot-reload workspace limit (5). The connection is
    kept alive; restart the app to get a fresh hot-reload session.

    All evicted apps stayed connected and running — the /rc socket is kept alive as proposed, no reconnect storm.

    Reclaim confirmed by gcroot on a process dump at 8 apps / 4 evictions: 5 rooted DebuggingSession (= the cap), 3
    unrooted
    — exactly the apps evicted while connected. The workspace and EnC session are genuinely unrooted, nothing
    leaked.

  3. Jen-Uno commented on Sep 30, 2026

    @Jen-Uno
    Contributor

    QA: closing out without a manual pass. The fix in #24240 ships with automated tests (Given_HotReloadWorkspaceRegistry.cs) that exercise the change.

    If you still see this behaviour on a build that includes that PR, please reopen or comment here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions