-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
Socket undestroy race #29708
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
Uh oh!
There was an error while loading. Please reload this page.
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: