-
Notifications
You must be signed in to change notification settings - Fork 30.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TCP socket emits error
after close
#35313
Comments
|
Is this still a problem in v14? We did a lot of fixes related to this kind of things. |
@mmomtchev that's why I suggest that this issue might not be a bug, but some missing details in the documentation. The docs claim 2 things (see the description of the issue) and none of them is fulfilled in this example. @ronag I've just performed the experiment using node |
@ronag This is the second similar question that I see, what should be the correct behavior of Node in this case? Is Node supposed to completely mask |
|
So |
The callback would still provide an error, but yes, no errors should be emitted. |
There's no |
What steps will reproduce the bug?
This might not be a bug itself, but just some missing details in the documentation. The documentation about TCP sockets claim 2 things:
close
event (this is claimed in Writable streams)close
event is always emitted after anerror
event (this is claimed in net.SocketThere seems to be an edge case (writing into the socket after the close event) where both claims fail. To reproduce it, you will need to:
node listener.js
node sender.js
CLOSE
trace was written before theERROR
trace in the sender console.I understand that you are not supposed to write in a socket after having received the
close
event, so this behavior might not be a bug, but it might require some changes in the docs.I came across this behavior because it happened in one of our node.js applications in production and I was assuming in my code that
error
events could never come afterclose
events. Of course, the real case was not as obvious as the example provided, and it was way trickier.The text was updated successfully, but these errors were encountered: