fix(dashboard): close the dropped live-read session; subscribe-and-track off the caller's token (DSH-002 #248, DSH-007, #253)

This commit is contained in:
Joseph Doherty
2026-12-03 09:47:46 -05:00
parent 0673b0c76c
commit 159524edd9
3 changed files with 131 additions and 17 deletions
+12
View File
@@ -637,6 +637,18 @@ its lease expires. One session means one worker process backs every dashboard
circuit; all access is serialised so the worker sees one in-flight command at a
time. Tag reads go through `GatewaySession.SubscribeBulkAsync` / `ReadBulkAsync`.
When a read fails for any reason other than cancellation, the service closes that
session before dropping it, and the next read opens a new one. A command timeout
or a non-Ok bulk reply leaves the session `Ready` with a live worker and its
advised tags; dropping only the reference left it in the registry until its lease
expired, and a Browse page that kept failing opened a new session every poll
until `MaxSessions` refused real clients. A Register failure on a freshly opened
session closes it the same way. The subscribe-and-track step and the eviction
unadvise run on `CancellationToken.None` (bounded by the session's command
timeout) and observe the caller's token only afterwards, so a page that cancels
its read mid-subscribe cannot leave tags advised on the worker that the advise
set does not track.
The advise set that backs those reads is capped at 256 tags (one browse page plus
headroom) and evicted least-recently-read-first. Without the cap every tag any
viewer ever inspected stayed advised on the single dashboard worker until the