You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've encountered an unexpected behavior when creating multiple ProxyAgent instances with abort signals. When creating more than 10 proxy agents, I receive a MaxListenersExceededWarning, suggesting a potential memory leak.
Reproducible By:
const{ ProxyAgent }=require('undici');// for demonstration it is necessary to create many such agents with a signalconstagent=newProxyAgent({uri: 'http://8.8.8.8:8000',proxyTls: {signal: AbortSignal.timeout(10_000),},});
Issues Observed:
Warning Message Received:
Copy(node:38318) MaxListenersExceededWarning: Possible EventTarget memory leak detected. 11 abort listeners added to [AbortSignal].
Use events.setMaxListeners() to increase limit
at [kNewListener] (node:internal/event_target:567:17)
at [kNewListener] (node:internal/abort_controller:268:24)
at AbortSignal.addEventListener (node:internal/event_target:680:23)
at addAbortListener (node:internal/events/abort_listener:38:12)
at node:net:1635:20
at process.processTicksAndRejections (node:internal/process/task_queues:77:11)
Memory Impact:
Before adding proxyTls with signal: ~2.5GB memory usage
After adding proxyTls with signal: ~3.5GB memory usage
Note: These memory measurements are from my specific project implementation and may vary in other environments. They are provided to illustrate the relative increase in memory consumption after adding the signal functionality.
Expected Behavior:
The use of abort signals should not trigger EventEmitter memory leak warnings, as these are designed to be temporary listeners. Additionally, the significant memory increase (1GB) seems disproportionate for this functionality.
Is this a potential bug in how interrupt signals are handled by ProxyAgent? If this is confirmed, I can try to resolve this issue.
The text was updated successfully, but these errors were encountered:
Can you provide steps to reproduce? We often need a reproducible example, e.g. some code that allows someone else to recreate your problem by just copying and pasting it. If it involves more than a couple of different file, create a new repository on GitHub and add a link to that.
Description
I've encountered an unexpected behavior when creating multiple ProxyAgent instances with abort signals. When creating more than 10 proxy agents, I receive a MaxListenersExceededWarning, suggesting a potential memory leak.
Reproducible By:
Issues Observed:
Warning Message Received:
Copy(node:38318) MaxListenersExceededWarning: Possible EventTarget memory leak detected. 11 abort listeners added to [AbortSignal]. Use events.setMaxListeners() to increase limit at [kNewListener] (node:internal/event_target:567:17) at [kNewListener] (node:internal/abort_controller:268:24) at AbortSignal.addEventListener (node:internal/event_target:680:23) at addAbortListener (node:internal/events/abort_listener:38:12) at node:net:1635:20 at process.processTicksAndRejections (node:internal/process/task_queues:77:11)
Memory Impact:
Note: These memory measurements are from my specific project implementation and may vary in other environments. They are provided to illustrate the relative increase in memory consumption after adding the signal functionality.
Expected Behavior:
The use of abort signals should not trigger EventEmitter memory leak warnings, as these are designed to be temporary listeners. Additionally, the significant memory increase (1GB) seems disproportionate for this functionality.
Is this a potential bug in how interrupt signals are handled by ProxyAgent? If this is confirmed, I can try to resolve this issue.
The text was updated successfully, but these errors were encountered: