Skip to content

net: make TCP Server and Socket transferable across worker threads#64225

Open
mcollina wants to merge 4 commits into
nodejs:mainfrom
mcollina:net-transfer-handles-worker-threads
Open

net: make TCP Server and Socket transferable across worker threads#64225
mcollina wants to merge 4 commits into
nodejs:mainfrom
mcollina:net-transfer-handles-worker-threads

Conversation

@mcollina

@mcollina mcollina commented Jul 1, 2026

Copy link
Copy Markdown
Member

Move a listening net.Server or an accepted net.Socket to another thread via a worker_threads postMessage() transferList. Unix only; Windows throws.

Allow a listening net.Server or an accepted net.Socket to be moved to
another thread by listing it in the transferList of a worker_threads
postMessage() call. Unix only; Windows throws.

Signed-off-by: Matteo Collina <hello@matteocollina.com>
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/net

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run. labels Jul 1, 2026
mcollina added 2 commits July 1, 2026 10:14
Signed-off-by: Matteo Collina <hello@matteocollina.com>
Previously a transferred net.Socket stayed alive on the sending side and
silently dropped writes. Destroy it so further use fails with
ERR_STREAM_DESTROYED.

Signed-off-by: Matteo Collina <hello@matteocollina.com>
@mcollina mcollina marked this pull request as ready for review July 1, 2026 13:08
@mcollina mcollina requested review from Renegade334 and addaleax and removed request for addaleax July 1, 2026 13:46
Signed-off-by: Matteo Collina <hello@matteocollina.com>
@addaleax addaleax added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. request-ci Add this label to start a Jenkins CI on a PR. labels Jul 5, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jul 5, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs that have at least one approval, no pending requests for changes, and a CI started. c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants