Skip to content

fix(monitor): clean per-session Maps on signal shutdown (#1115)#1255

Merged
OneStepAt4time merged 1 commit into
developfrom
fix/1115-monitor-maps-cleanup
Apr 6, 2026
Merged

fix(monitor): clean per-session Maps on signal shutdown (#1115)#1255
OneStepAt4time merged 1 commit into
developfrom
fix/1115-monitor-maps-cleanup

Conversation

@OneStepAt4time
Copy link
Copy Markdown
Owner

Bug: signal-cleanup-helper.ts called sessions.killSession but did NOT call cleanupTerminatedSessionState. When SIGTERM/SIGINT fired, all monitor/metrics/toolRegistry per-session Maps accumulated stale entries — memory leak.

Fix:

  1. Added optional SessionCleanupDeps parameter to killAllSessions and killAllSessionsWithTimeout in signal-cleanup-helper.ts
  2. After each killSession, call cleanupTerminatedSessionState if deps provided
  3. Updated server.ts shutdown path to pass { monitor, metrics, toolRegistry }

Note: removeSession (monitor cleanup) was already comprehensive — the issue was that it was never called in the signal shutdown path.

Developed with Aegis v0.1.0-alpha

Refs: #1115

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant