← Back to list
01Issue
BugClosedSwamp CLI
AssigneesNone
MaxListenersExceededWarning shown after repeated CLI commands
Opened by swampadmin · 12/20/2024
Description
After running several swamp CLI commands in a session, Node.js emits this warning to stderr:
(node:PID) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 exit listeners added to [EventEmitter [process]]. MaxListeners is 10.The warning appears on every subsequent command invocation once the threshold is crossed. It does not affect functionality but is visible to users and suggests a minor listener leak.
Steps to Reproduce
- Run any sequence of 10+ swamp CLI commands in a session, e.g.:
swamp model type search k8s --json swamp model create @myns/pod my-pods --json swamp model method run my-pods list --json # ... repeat various commands
- After approximately 10 commands, the warning begins appearing on every invocation.
Expected Behavior
No Node.js warnings should be emitted during normal CLI usage.
Actual Behavior
Every command after the ~10th prints the MaxListenersExceededWarning to stderr.
Likely Cause
Each CLI invocation appears to add an exit event listener to process without removing previous ones. After 11 listeners accumulate, Node.js triggers the default warning. The fix is likely either:
- Calling
process.removeListener('exit', ...)when listeners are no longer needed - Calling
process.setMaxListeners(n)if the listeners are intentional - Ensuring cleanup in the KubeConfig or API client initialization path (the
@kubernetes/client-nodelibrary may also contribute listeners per API client instantiation)
Environment
- swamp version: 20260227.010040.0-sha.9cd80fb4
- OS: macOS (Darwin 22.6.0)
- Node runtime: Deno (bundled with swamp)
02Bog Flow
Closed
No activity in this phase yet.
03Sludge Pulse
Sign in to post a ripple.