Closed
Description
- Version: 15.0.0, 15.0.1
- Platform: linux, windows
- Subsystem: x64
What steps will reproduce the bug?
-
install any node v15.0.x on windows or linux
-
copy-paste the following in shell (or git-bash for windows):
#!/bin/sh
node -e '
/*jslint node*/
"use strict";
require("http").createServer(function (ignore, res) {
res.on("error", function () {
return;
});
res.end("cc");
res.end("dd");
}).listen(8081, function () {
require("http").request("http://localhost:8081").end();
});
'
# stderr
#
# node:internal/assert:14
# throw new ERR_INTERNAL_ASSERTION(message);
# ^
#
# Error [ERR_INTERNAL_ASSERTION]: This is caused by either a bug in Node.js or incorrect usage of Node.js internals.
# Please open an issue with this stack trace at https://github.com/nodejs/node/issues
#
# at new NodeError (node:internal/errors:258:15)
# at assert (node:internal/assert:14:11)
# at ServerResponse.detachSocket (node:_http_server:239:3)
# at resOnFinish (node:_http_server:799:7)
# at ServerResponse.emit (node:events:327:20)
# at onFinish (node:_http_outgoing:794:10)
# at afterWrite (node:internal/streams/writable:496:5)
# at afterWriteTick (node:internal/streams/writable:483:10)
# at processTicksAndRejections (node:internal/process/task_queues:79:21) {
# code: 'ERR_INTERNAL_ASSERTION'
# }
How often does it reproduce? Is there a required condition?
- reproducible everytime.
- conditions:
- ServerResponse must have listener on
error
event ServerResponse.prototype.end(...)
must be called more than once with non-empty payload
What is the expected behavior?
there should be no ERR_INTERNAL_ASSERTION
raised
What do you see instead?
ERR_INTERNAL_ASSERTION
raised
Additional information
ERR_INTERNAL_ASSERTION
raised at https://github.com/nodejs/node/blob/v15.0.1/lib/_http_server.js#L239
ServerResponse.prototype.detachSocket = function detachSocket(socket) {
assert(socket._httpMessage === this); // failed assertion
socket.removeListener('close', onServerResponseClose);
socket._httpMessage = null;
this.socket = null;
};