Skip to content
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

lib: fix listen with handle in cluster worker #52056

Merged
merged 1 commit into from
Mar 14, 2024

Conversation

theanarkh
Copy link
Contributor

  1. fork a process by cluster.fork.
  2. call net.createServer().listen(handle) in worker.
  3. the worker will pass some invalid parameters to main process by calling cluster._getServer.
  4. throw an error in main process when try to create a handle or server.

the error is as follows.

TypeError [ERR_INVALID_ARG_VALUE]: The argument 'options' is invalid. Received {
  path: null,
  backlog: 0,
  readableAll: undefined,
  writableAll: undefined
}
    at new NodeError (node:internal/errors:405:5)
    at Server.listen (node:net:2016:9)
    at new RoundRobinHandle (node:internal/cluster/round_robin_handle:36:17)
    at queryServer (node:internal/cluster/primary:298:16)
    at Worker.onmessage (node:internal/cluster/primary:254:5)
    at ChildProcess.onInternalMessage (node:internal/cluster/utils:49:5)
    at ChildProcess.emit (node:events:523:35)
    at emit (node:internal/child_process:944:14)
    at process.processTicksAndRejections (node:internal/process/task_queues:83:21) 

I think it should not call cluster._getServer in this scenario(listen with handle).

  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/net

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. net Issues and PRs related to the net subsystem. labels Mar 12, 2024
@theanarkh theanarkh added the request-ci Add this label to start a Jenkins CI on a PR. label Mar 13, 2024
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Mar 13, 2024
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mcollina mcollina added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. commit-queue Add this label to land a pull request using GitHub Actions. and removed needs-ci PRs that need a full CI run. labels Mar 14, 2024
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Mar 14, 2024
@nodejs-github-bot nodejs-github-bot merged commit 20525f1 into nodejs:main Mar 14, 2024
66 checks passed
@nodejs-github-bot
Copy link
Collaborator

Landed in 20525f1

rdw-msft pushed a commit to rdw-msft/node that referenced this pull request Mar 26, 2024
PR-URL: nodejs#52056
Reviewed-By: Paolo Insogna <paolo@cowtech.it>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
marco-ippolito pushed a commit that referenced this pull request May 2, 2024
PR-URL: #52056
Reviewed-By: Paolo Insogna <paolo@cowtech.it>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
marco-ippolito pushed a commit that referenced this pull request May 3, 2024
PR-URL: #52056
Reviewed-By: Paolo Insogna <paolo@cowtech.it>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
jcbhmr pushed a commit to jcbhmr/node that referenced this pull request May 15, 2024
PR-URL: nodejs#52056
Reviewed-By: Paolo Insogna <paolo@cowtech.it>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
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. net Issues and PRs related to the net subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants