Review 2026-12-02 Phase 2: Session and worker lifecycle fixes #253
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Phase 2 — Session and worker lifecycle (p1)
IHostApplicationLifetime.ApplicationStoppingcallback (or a hosted service registered to stop first): close all sessions (workers shut down cleanly), which completes the openStreamEvents. Keep the kill as a fallback after a bounded grace.finally(or on any non-faulting failure). Track advised tags before awaiting, so a cancelled subscribe can still unadvise.DetachGraceSeconds. Take the later of the two deadlines, or renew the lease while the stream is attached.Http2.KeepAlivePingDelay/Timeout) underMxGateway:*with defaults, validate it inGatewayOptionsValidator, and document it indocs/GatewayConfiguration.md.Process.WaitForExitAsync. On early exit, report the exit code and stderr tail. Launch-failure cleanup wrapsKillin try/catch and always disposes the pipe.TimeProvider/Stopwatchmonotonic time for heartbeat staleness.EventReceivedagainst re-creating a removed session entry (check a removed flag, or remove under the same lock).Unregisterpurges the session's item registrations.ShuttingDown. Keep a pipe read outstanding, or a parent-PID check, during MXAccess startup, and put a timeout on the hello read.Verify: gateway build +
Session*,WorkerClient*,GatewayEndToEndFakeWorkerSmokeTests. Worker items (2.11) also need the windev x86 build and Worker.Tests.High findings filed separately:
Source:
code-reviews/2026-12-02-perf-bugs/README.mdandcode-reviews/2026-12-02-perf-bugs/PLAN.md(commitf200bda6on local branchdocs/review-2026-12-02-perf-bugs, not yet pushed). Reviewed at54367e74.Decision (2026-12-03, recorded as D7 in
code-reviews/2026-12-02-perf-bugs/PLAN.md): keepalive defaults: server pings after 60 s idle with a 10 s timeout and permits client pings every 30 s, including with no active call; all configurable underMxGateway:*.Merged to
mainat68043411(pushed 2026-12-03). Gateway suite 1610 passed / 0 failed (macOS); windev worker CI 836 passed / 0 failed on that SHA.All rows 2.1–2.11 done. Server keepalive:
MxGateway:Protocol:Http2KeepAlivePingDelaySeconds(60) /Http2KeepAlivePingTimeoutSeconds(10); Kestrel has no min-client-ping setting and never GOAWAYs on ping rate. Behaviour change: orphan cleanup skips (logs) processes whose path and command line are both unreadable. WRK-002 stderr tail split out to #259.