Skip to content

Commit 7c06eab

Browse files
authored
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 <[email protected]> Reviewed-By: Robert Nagy <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Beth Griggs <[email protected]> Reviewed-By: Tierney Cyren <[email protected]>
1 parent 3fdf6cf commit 7c06eab

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
@@ -809,10 +809,7 @@ const requestHeaderFieldsTooLargeResponse = Buffer.from(
809809
function socketOnError(e) {
810810
// Ignore further errors
811811
this.removeListener('error', socketOnError);
812-
813-
if (this.listenerCount('error') === 0) {
814-
this.on('error', noop);
815-
}
812+
this.on('error', noop);
816813

817814
if (!this.server.emit('clientError', e, this)) {
818815
// 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)