-
Notifications
You must be signed in to change notification settings - Fork 728
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Abort signal - Possible EventEmitter memory leak detected. 11 abort listeners added to [EventEmitter]. Use emitter.setMaxListeners() to increase limit #1716
Comments
I'm trying to get more info. |
Might be related to pipelining. |
Getting this warning too 👍 |
So this has nothing to do with abort signal. It has to do with number of concurrent requests without signals. Every request without signal adds an |
Estou recebendo o mesmo aviso aqui também. Não sei se essa issue pode ajudar em algo: node-fetch/node-fetch#1295 |
|
This was fixed and released in v8.8.1. See elastic/elastic-transport-js#63. |
I'm running into this currently, using |
Thanks for linking to that issue @daveyarwood. I'll take another look and continue to keep track over on elastic/elastic-transport-js#63. |
A potential fix for #63, largely inspired by a community member's PR that was never merged: #55 According to an Undici core committer in this comment elastic/elasticsearch-js#1716 (comment) the issue that triggers the MaxListenersExceededWarning, and possibly a memory leak in some cases, is caused by attaching an EventEmitter to each request by default when a per-request timeout is set, rather than attaching an AbortSignal. My assumption is that an EventEmitter was used because AbortSignal and AbortController were not added to Node.js until v14.17.0, so we couldn't guarantee v14 users would have it. I'm not certain why using EventEmitters makes a difference memory-wise, but it does get rid of the MaxListenersExceededWarning.
A potential fix for #63, largely inspired by a community member's PR that was never merged: #55 According to an Undici core committer in this comment elastic/elasticsearch-js#1716 (comment) the issue that triggers the MaxListenersExceededWarning, and possibly a memory leak in some cases, is caused by attaching an EventEmitter to each request by default when a per-request timeout is set, rather than attaching an AbortSignal. My assumption is that an EventEmitter was used because AbortSignal and AbortController were not added to Node.js until v14.17.0, so we couldn't guarantee v14 users would have it. I'm not certain why using EventEmitters makes a difference memory-wise, but it does get rid of the MaxListenersExceededWarning.
When using abort signal with the esc client I get the following:
Possible EventEmitter memory leak detected. 11 abort listeners added to [EventEmitter]. Use emitter.setMaxListeners() to increase limit
Is esc or maybe undici missing to release the abort signal handler?
The text was updated successfully, but these errors were encountered: