-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
Socket undestroy race #29708
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Looking at the code for
Socket.connect
it seems that a socket that has been destroyed can be re-used.However, the way the code is currently written (https://github.com/nodejs/node/blob/master/lib/net.js#L929) the socket can be
undestroy
:ed while the socket hasn't finished destroying.Consider the following:
The socket is re-used directly after
destroy
and_undestroy
is called, before the_destroy
callback has had a chance to run causing a potentially weird undefined state.I believe we should wait for
'close'
inSocket.connect
before doing anything further to the instance.Or am I missing something? @jasnell
The text was updated successfully, but these errors were encountered: