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

http2: Prevent unnecessary listeners from being registered #27987

Closed
wants to merge 6 commits into from
Closed

http2: Prevent unnecessary listeners from being registered #27987

wants to merge 6 commits into from

Conversation

akukas
Copy link
Contributor

@akukas akukas commented May 30, 2019

When multiple requests are started on a client HTTP/2 session while it it still connecting, a warning might get emitted: MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 connect listeners added to Http2Session

This PR modifies the offending code so that only one event listener is registered, no matter how many requests are started. A test for the fix is included.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines

@nodejs-github-bot nodejs-github-bot added the http2 Issues or PRs related to the http2 subsystem. label May 30, 2019
lib/internal/http2/core.js Outdated Show resolved Hide resolved
lib/internal/http2/core.js Outdated Show resolved Hide resolved
lib/internal/http2/core.js Outdated Show resolved Hide resolved
lib/internal/http2/core.js Outdated Show resolved Hide resolved
Update symbol description to match the name.
Initialize field in the constructor.
Reset field instead of deleting it.
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@BridgeAR BridgeAR added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Jun 4, 2019
@addaleax
Copy link
Member

Landed in bcf1135

@addaleax addaleax closed this Jun 10, 2019
addaleax pushed a commit that referenced this pull request Jun 10, 2019
PR-URL: #27987
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
BridgeAR pushed a commit that referenced this pull request Jun 17, 2019
PR-URL: #27987
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
@BridgeAR BridgeAR mentioned this pull request Jun 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. http2 Issues or PRs related to the http2 subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants