AntFleet

Disagreement · d9ae4fa5-anthropic-1

Abort signal listener on retry backoff is never removed, leaking listeners across attempts

solo Opus
repo 56f59a0d·PR #3·reviewed 4 days ago

Opus finding

Abort signal listener on retry backoff is never removed, leaking listeners across attempts

mediumbughigh
  • src/providers/orchestrator.ts:285-296
When the timer fires normally (no abort), the 'abort' listener installed with { once: true } is NOT removed because it was never invoked. Across multiple retry attempts on a long-lived signal (e.g. options.signal passed by caller), each backoff adds a new dangling listener. Over many calls in a long-running orchestrator, this accumulates listeners on the user-supplied AbortSignal (which may also be the watchdog signal). Even with once:true, the listener still holds a closure over timer/resolve until garbage-collected with the signal. If the signal aborts later, all stale listeners fire and call resolve() (harmless) and clearTimeout (harmless), but Node will emit MaxListenersExceededWarning after 10 attempts on the same signal.

Recommendation

Track the listener and removeEventListener on the timer's resolve path, or use AbortSignal.timeout / a helper that wires/unwires both directions.

Other reviewer

The other reviewer flagged nothing in this file/line range.

Why this didn't post

This finding didn't meet AntFleet's unanimous agreement threshold. Both frontier models review every PR independently; only findings they both flag with the same severity and category are posted to the PR. This one fell through.

read the methodology →