No error is emitted on response destroy when socket is already destroyed #35923
Closed as not planned
Description
opened on Nov 2, 2020
- 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:
Lines 121 to 125 in c1da528
The error is not thrown because the socket has been destroyed. Although the response has not.
Activity