Skip to content

Commit 2882e60

Browse files
lpincadanielleadams
authored andcommittedJan 3, 2023
Revert "http: do not leak error listeners"
This reverts commit 736a7d8. The patch attempted to fix an issue, signaled by a warning, caused by an invalid API usage. However it introduced a behavior change that is breaking userland modules. It is a user error, so restore the original behavior and have the user investigate and fix the issue in their code. Refs: #43587 (comment) Refs: #43587 (comment) PR-URL: #44921 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Beth Griggs <bethanyngriggs@gmail.com> Reviewed-By: Tierney Cyren <hello@bnb.im>
1 parent 8c2d0f9 commit 2882e60

File tree

2 files changed

+1
-48
lines changed

2 files changed

+1
-48
lines changed
 

‎lib/_http_server.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -813,10 +813,7 @@ const requestHeaderFieldsTooLargeResponse = Buffer.from(
813813
function socketOnError(e) {
814814
// Ignore further errors
815815
this.removeListener('error', socketOnError);
816-
817-
if (this.listenerCount('error') === 0) {
818-
this.on('error', noop);
819-
}
816+
this.on('error', noop);
820817

821818
if (!this.server.emit('clientError', e, this)) {
822819
// Caution must be taken to avoid corrupting the remote peer.

‎test/parallel/test-http-socket-listeners.js

-44
This file was deleted.

0 commit comments

Comments
 (0)
Please sign in to comment.