- Version: v15.0.0-v15.1.0, master
- Platform: Linux
- Subsystem: net
What steps will reproduce the bug?
constnet=require('net');net.createServer(function(s){this.close();s.end();}).listen(0,'localhost',function(){constsocket=net.connect(this.address().port,'localhost');socket.on('end',()=>{console.log('socket.writable',socket.writable);if(socket.writable)socket.write('hello world');});});How often does it reproduce? Is there a required condition?
Every time.
What is the expected behavior?
No error emitted on the socket.
Output (on node v14.x and earlier):
What do you see instead?
Output:
socket.writable true
node:events:304
throw er; // Unhandled 'error' event
^
Error: This socket has been ended by the other party
at Socket.writeAfterFIN [as write] (node:net:443:14)
at Socket.<anonymous> (/tmp/test.js:11:14)
at Socket.emit (node:events:339:22)
at endReadableNT (node:internal/streams/readable:1289:12)
at processTicksAndRejections (node:internal/process/task_queues:80:21)
Emitted 'error' event on Socket instance at:
at emitErrorNT (node:internal/streams/destroy:188:8)
at emitErrorCloseNT (node:internal/streams/destroy:153:3)
at processTicksAndRejections (node:internal/process/task_queues:80:21) {
code: 'EPIPE'
}
Additional information
The description for writable.writable in the streams docs reads:
Is true if it is safe to call writable.write(), which means the stream has not been destroyed, errored or ended.
So I believe this is a regression.
/cc @nodejs/net
What steps will reproduce the bug?
How often does it reproduce? Is there a required condition?
Every time.
What is the expected behavior?
No error emitted on the socket.
Output (on node v14.x and earlier):
What do you see instead?
Output:
Additional information
The description for
writable.writablein the streams docs reads:So I believe this is a regression.
/cc @nodejs/net