Repository navigation
net: pending socket re-use #30832
Description
Activity
I think those things would ideally need to be fixed, however this is a really obscure feature of Node.js, and I suspect most do not even know that is there or why it's needed. If the fix are trivial, go for them. If they are complex, then it's probably not worth it.
Reacted by Anna Henningsen and Ruben BridgewaterI'll look into it when porting it over to
_construct.If they are complex, then it's probably not worth it.
Would it be an option to hard deprecate re-use and error when trying to do so?
Would it be an option to hard deprecate re-use and error when trying to do so?
Possibly, I'm not sure if there are some usage in the wild.
- addednetIssues and PRs related to the net subsystem.Issues and PRs related to the net subsystem.
on Dec 20, 2019 I find
connectw/ re-use kind of dangerous. Could we doc deprecate, add a runtime warning or something along those lines?github-actions commented
on Jun 27, 2026 on Jun 27, 2026 – with GitHub ActionsContributorMore actionsThis issue has been marked as stale due to 210 days of inactivity.
It will be automatically closed in 30 days if no further activity occurs. If this is still relevant, please leave a comment or update it to keep it open.github-actions commented
on Jul 28, 2026 on Jul 28, 2026 – with GitHub ActionsContributorMore actionsThis issue has been automatically closed after 30 days of inactivity following its stale status (no activity for a total of 120 days).
If this is still relevant, feel free to reopen it or leave a comment with additional details so we can continue the discussion.
It looks like
net.Socketinstances are intended to be re-used however while reading through the code I spot some potential problems:_destroy(): doesn't wait for connect to finishconnect: doesn't first destroy if already connected, before connecting againconnect: doesn't wait for pending destroy to finish, before calling e.g._undestroy()Not sure if these are actual problems that need to be fixed?
@mcollina