Skip to content

http2: Prevent unnecessary listeners from being registered

Rodrigo Muino Tomonari requested to merge github/fork/akukas/patch-1 into master

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

Merge request reports

Loading