-
-
Notifications
You must be signed in to change notification settings - Fork 34.2k
Closed
Labels
netIssues and PRs related to the net subsystem.Issues and PRs related to the net subsystem.regressionIssues related to regressions.Issues related to regressions.
Description
- Version: v15.0.0-v15.1.0, master
- Platform: Linux
- Subsystem: net
What steps will reproduce the bug?
const net = require('net');
net.createServer(function(s) {
this.close();
s.end();
}).listen(0, 'localhost', function() {
const socket = 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):
socket.writable false
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
trueif it is safe to callwritable.write(), which means the stream has not been destroyed, errored or ended.
So I believe this is a regression.
/cc @nodejs/net
Metadata
Metadata
Assignees
Labels
netIssues and PRs related to the net subsystem.Issues and PRs related to the net subsystem.regressionIssues related to regressions.Issues related to regressions.