fix(lmxproxy): clean up stale session subscriptions on scavenge and add stream timeout
Grpc.Core doesn't reliably fire CancellationToken on client disconnect, so Subscribe RPCs can hang forever and leak session subscriptions. Bridge SessionManager scavenging to SubscriptionManager cleanup, and add a 30-second periodic session validity check in the Subscribe loop so stale streams exit within 30s of session scavenge rather than hanging until process restart. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -112,6 +112,11 @@ namespace ZB.MOM.WW.LmxProxy.Host
|
||||
|
||||
// 8. Create SessionManager
|
||||
_sessionManager = new SessionManager(inactivityTimeoutMinutes: 5);
|
||||
_sessionManager.OnSessionScavenged(sessionId =>
|
||||
{
|
||||
Log.Information("Cleaning up subscriptions for scavenged session {SessionId}", sessionId);
|
||||
_subscriptionManager.UnsubscribeClient(sessionId);
|
||||
});
|
||||
|
||||
// 9. Create performance metrics
|
||||
_performanceMetrics = new PerformanceMetrics();
|
||||
|
||||
Reference in New Issue
Block a user