Skip to content

fix(cluster): respect the backlog from workers - #33827

Closed
oyyd wants to merge 2 commits into
nodejs:masterfrom
oyyd:cluster-backlog
Closed

fix(cluster): respect the backlog from workers#33827
oyyd wants to merge 2 commits into
nodejs:masterfrom
oyyd:cluster-backlog

Conversation

@oyyd

@oyydoyyd commented Jun 10, 2020

Copy link
Copy Markdown
Contributor

Encounter the same issue of #4056.

Currently, the master process would ignore backlog passed from worker processes and use the default value instead. This commit will respect the first backlog passed to the master process for a specific handle.

It seems hard to test backlog in a Node.js script. I use the script below and ss to check backlog. It's correct on my Linux(Ubuntu):

constnet=require('net');constcluster=require('cluster');constpath=require('path');if(cluster.isMaster){constworkers=[];for(leti=0;i<2;i+=1){constworker=cluster.fork();workers.push(worker);}}else{net.createServer().listen(9230,7);// ss -lnet.createServer().listen(path.resolve(__dirname,'./test.sock'),7);// ss -x -l}
Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • documentation is changed or added
  • commit message follows commit guidelines

@nodejs-github-botnodejs-github-bot added cluster Issues and PRs related to the cluster subsystem. net Issues and PRs related to the net subsystem. labels Jun 10, 2020
@addaleax

Copy link
Copy Markdown
Member

@oyyd Could you add a test for this?

@oyyd

oyyd commented Jun 12, 2020

Copy link
Copy Markdown
ContributorAuthor

@addaleax Have added a test monkey-patching the net module to ensure it works as expected.

@oyyd
oyyd requested a review from a team as a code ownerAugust 10, 2020 16:07
@oyyd
oyyd requested a review from a teamAugust 10, 2020 16:07
@oyyd
oyydforce-pushed the cluster-backlog branch 2 times, most recently from 9262918 to b322936CompareAugust 13, 2020 13:33
@nodejs-github-bot

This comment has been minimized.

@nodejs-github-bot

This comment has been minimized.

@nodejs-github-bot

This comment has been minimized.

@nodejs-github-bot

This comment has been minimized.

@nodejs-github-bot

This comment has been minimized.

@nodejs-github-bot

This comment has been minimized.

@nodejs-github-bot

This comment has been minimized.

@nodejs-github-bot

This comment has been minimized.

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Currently, the master process would ignore `backlog` from worker
processes and use the default value instead. This commit will respect
the first `backlog` passed to the master process for a specific handle.
Refs: nodejs#4056
@oyyd

oyyd commented Aug 18, 2020

Copy link
Copy Markdown
ContributorAuthor

The included test failed on a windows environment of CI as both net.Server.prototype.listen and net.Server.prototype._listen2 don't get called. Need more investigation.

@nodejs-github-bot

This comment has been minimized.

@nodejs-github-bot

This comment has been minimized.

@mcollinamcollina left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm

@mcollina

Copy link
Copy Markdown
Member

@oyyd do you plan to keep working on this?

@nodejs-github-bot

This comment has been minimized.

@nodejs-github-bot

This comment has been minimized.

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@aduh95

Copy link
Copy Markdown
Contributor

@oyyd Test is consistently failing on Windows. Can you take a look?

@aduh95aduh95 added stalled Issues and PRs that are stalled. and removed author ready PRs that have at least one approval, no pending requests for changes, and a CI started. labels Nov 11, 2020
@github-actions

Copy link
Copy Markdown
Contributor

This issue/PR was marked as stalled, it will be automatically closed in 30 days. If it should remain open, please leave a comment explaining why it should remain open.

@oyyd

oyyd commented Nov 11, 2020

Copy link
Copy Markdown
ContributorAuthor

I can't fix the failure on windows.. so that I'm going to close this PR.

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

Labels

clusterIssues and PRs related to the cluster subsystem.netIssues and PRs related to the net subsystem.stalledIssues and PRs that are stalled.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@oyyd@addaleax@nodejs-github-bot@mcollina@aduh95@jasnell