fix(dcl): MxGateway adapter treats a graceful end of the event stream as a disconnect — a dashboard 'close session' (or graceful gateway shutdown) completes the stream with OK, leaving the adapter Connected on a dead session: values frozen at last GOOD quality, every write 'Session … was not found' until restart (QA vq03 Z28061 MoveIn, 2026-08-20). Pinned: signals once while connected, silent for superseded loops / own teardown

This commit is contained in:
Joseph Doherty
2026-08-20 16:51:13 -04:00
parent f5a74db3de
commit da0bfe2be1
3 changed files with 81 additions and 1 deletions
@@ -182,6 +182,23 @@ public class MxGatewayDataConnection
if (_tagToSub.TryGetValue(update.TagPath, out var subId) && _subs.TryGetValue(subId, out var s))
s.Callback(update.TagPath, new TagValue(update.Value, update.Quality, update.Timestamp));
}, ct);
// A GRACEFUL end of the event stream (OK status, no fault) while we did not ask
// for it means the gateway closed the session underneath us — a dashboard
// "close session", or a graceful gateway shutdown, both complete the per-session
// subscriber channels with no error (CompleteAllSubscribers(error: null)).
// Before this branch existed the loop simply returned: the adapter stayed
// Connected, every subscribed value froze at its last GOOD quality, and every
// write hit the dead session ("Session … was not found") until a process
// restart — QA incident 2026-08-20, vq03 Z28061 MoveIn, one hour of silent loss.
// Same bug class as SiteStreamGrpcClient's graceful-completion reconnect
// (commit 34a3f4bb). A cancelled token is our own teardown, never a disconnect.
if (!ct.IsCancellationRequested)
{
_logger.LogWarning(
"MxGateway event stream ended without a fault while connected — the gateway closed the session; signalling disconnect");
RaiseDisconnected();
}
}
catch (OperationCanceledException)
{