-
Notifications
You must be signed in to change notification settings - Fork 840
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
possible EventEmitter memory leak detected. 11 upgrade listeners added. Use emitter.setMaxListeners() to increase limit. #108
Comments
The code snippets doesn't seem to reveal the cause of the issue. Somewhere you are constantly subscribing to an event, instead of subscribing it once. Think StackOverflow is a better place to troubleshoot your project/setup. Feel free to re-open the issue if you think the memory leak is caused by http-proxy-middleware. In that case, please provide a minimal working setup to help identifying the issue. Thanks. |
This happened to me when I created the middleware on every single request. I saw this exact error and it was fixed by only creating the middleware once. Our servers would run out of memory in a few hours. Hope this helps. |
When upgrading the http-proxy-middleware library I accidentally caused the app to create a new proxy server on every request (whether for the proxy or not), rather than just on startup. This led to a memory leak, and the Node process crashing. This change creates it once, and uses the express-async-handler to get around triggering the no-misused-promises linting rule. Refs #1636, chimurai/http-proxy-middleware#108 (comment), https://github.com/chimurai/http-proxy-middleware/tree/v3.0.0?tab=readme-ov-file#express-server-example, https://typescript-eslint.io/rules/no-misused-promises/
(node) warning: possible EventEmitter memory leak detected. 11 upgrade listeners added. Use emitter.setMaxListeners() to
increase limit.
Trace
at Server.addListener (events.js:239:17)
at catchUpgradeRequest (E:\work\saas\node_modules.npminstall\http-proxy-middleware\0.17.1\http-proxy-middleware\lib
\index.js:51:16)
at middleware (E:\work\saas\node_modules.npminstall\http-proxy-middleware\0.17.1\http-proxy-middleware\lib\index.js
:46:13)
at Layer.handle as handle_request
at trim_prefix (E:\work\saas\node_modules\express\lib\router\index.js:312:13)
at E:\work\saas\node_modules\express\lib\router\index.js:280:7
at Function.process_params (E:\work\saas\node_modules\express\lib\router\index.js:330:12)
at next (E:\work\saas\node_modules\express\lib\router\index.js:271:10)
at logger (E:\work\saas\node_modules\morgan\index.js:144:5)
at Layer.handle as handle_request
Expected behavior
Actual behavior
Setup
proxy middleware configuration
i don't kown how to minitor the upgrade event
in your websocket example, everything just in one file。but in express project, it hava /app.js and /bin/www, i don't konw how to handler this.
looking forward to your reply.
The text was updated successfully, but these errors were encountered: