- Version: 10.x.x, 12.x.x, 14.x.x, 15.x.x
- Platform:
Linux solus 5.6.19-159.current #1 SMP PREEMPT Fri Oct 16 17:49:06 UTC 2020 x86_64 GNU/Linux
- Subsystem: http
What steps will reproduce the bug?
const http = require('http');
const request = http.get('http://httpbin.org/anything', response => {
setTimeout(() => {
console.log(`request.destroyed = ${request.destroyed}`);
console.log(`response.destroyed = ${response.destroyed}`);
response.destroy(new Error('failure'));
}, 1000);
});
How often does it reproduce? Is there a required condition?
Always.
What is the expected behavior?
An error with a message failure.
What do you see instead?
No error.
Additional information
While I understand that request is destroyed on socket close, the response.destroy logic is broken:
|
IncomingMessage.prototype.destroy = function destroy(error) { |
|
if (this.socket) |
|
this.socket.destroy(error); |
|
return this; |
|
}; |
The error is not thrown because the socket has been destroyed. Although the response has not.
Linux solus 5.6.19-159.current #1 SMP PREEMPT Fri Oct 16 17:49:06 UTC 2020 x86_64 GNU/LinuxWhat steps will reproduce the bug?
How often does it reproduce? Is there a required condition?
Always.
What is the expected behavior?
An error with a message
failure.What do you see instead?
No error.
Additional information
While I understand that
requestis destroyed on socket close, theresponse.destroylogic is broken:node/lib/_http_incoming.js
Lines 121 to 125 in c1da528
The error is not thrown because the socket has been destroyed. Although the response has not.