Node's undici module appears to be adding listeners for the "abort" event on any passed AbortSignal but then not cleaning them up.
This casues many MaxListenersExceededWarnings to appear in the console and likely causes a memory leak.
To work around this, use a short-lived AbortSignal for each request that can be garbage collected along with the request itself and trigger "abort" on it if the long-lived signal aborts, taking care to remove any added listeners once we are done with the request.
Node's
undici
module appears to be adding listeners for the"abort"
event on any passed AbortSignal but then not cleaning them up.This casues many
MaxListenersExceededWarning
s to appear in the console and likely causes a memory leak.To work around this, use a short-lived
AbortSignal
for each request that can be garbage collected along with the request itself and trigger"abort"
on it if the long-lived signal aborts, taking care to remove any added listeners once we are done with the request.See https://github.com/nodejs/undici/issues/3157 for more information.
Change checklist