Skip to content
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

MaxListenerExceededWarning with restify 8.6.0 #1883

Closed
3 tasks done
luddd3 opened this issue Nov 2, 2021 · 5 comments · Fixed by #1892
Closed
3 tasks done

MaxListenerExceededWarning with restify 8.6.0 #1883

luddd3 opened this issue Nov 2, 2021 · 5 comments · Fixed by #1892

Comments

@luddd3
Copy link

luddd3 commented Nov 2, 2021

When I updated to latest version of Restify. I started to get memory leak warnings.

  • Used appropriate template for the issue type
  • Searched both open and closed issues for duplicates of this issue
  • Title adequately and concisely reflects the feature or the bug

Restify Version: 8.6.0
Node.js Version: 14.18.1

Expected behaviour

No warnings

Actual behaviour

MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 close listeners added to [Socket]. Use emitter.setMaxListeners() to increase limit
    at _addListener (events.js:475:17)
    at Socket.addListener (events.js:497:10)
    at Socket.Readable.on (internal/streams/readable.js:853:35)
    at Socket.socketListenerWrap [as on] (_http_server.js:950:54)
    at Socket.once (events.js:541:8)
    at readBody (/code/node_modules/restify/lib/plugins/bodyReader.js:189:20)
    at nextTick (/code/node_modules/restify/lib/chain.js:167:13)
    at processTicksAndRejections (internal/process/task_queues.js:77:11)

Repro case

I don't know how to minimally reproduce it. I am running with a fairly large server in prod.

Cause

I suspect that this is the cause: #1880

Are you willing and able to fix this?

No, I am not able to fix it beyond just reverting the change in the pull request referenced above.

@pcwiek
Copy link

pcwiek commented Nov 5, 2021

We noticed the same thing on node 16. Bumping up the listener limit to 15 doesn't help either, then we're just getting (...) 16 close listeners added to [Socket] (..)

@svedbg
Copy link

svedbg commented Nov 5, 2021

Same issue observed in our organization and definitely the root cause is #1880
The following line introduces the leak: https://github.com/restify/node-restify/pull/1880/files#diff-556d8ee937e05276d90e3095ea5cd06908d128e446aac53fe57394896569585aR189
If I switch back from:
req.socket.once('close', next);
to
req.once('close', next);
the leak is not observable.
We're running dev/production servers on node 14.16.1

@mvoorberg
Copy link

Same issue on node v14.15.4 when using 8.6.0. Pinning at 8.5.1 for now.

@svedbg
Copy link

svedbg commented Dec 1, 2021

Any update on this one?

@josephharrington
Copy link
Contributor

This should be fixed in v8.6.1 released today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants