Skip to content

Conversation

@islandryu
Copy link
Member

@islandryu islandryu commented Oct 7, 2025

Fixes: #60086

If the message.index passed to queryServer becomes out of sync due to errors or other issues, it may prevent a cluster from reusing a port that was acquired by another cluster.
To address this, I modified the code so that the handle key no longer includes the index (except when the port number is 0), and only the latest handle corresponding to a successfully acquired port is stored.

@nodejs-github-bot nodejs-github-bot added cluster Issues and PRs related to the cluster subsystem. needs-ci PRs that need a full CI run. labels Oct 7, 2025
@codecov
Copy link

codecov bot commented Oct 7, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.52%. Comparing base (cff138c) to head (7a1b5b4).
⚠️ Report is 729 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #60141      +/-   ##
==========================================
+ Coverage   88.45%   88.52%   +0.06%     
==========================================
  Files         703      703              
  Lines      207546   207821     +275     
  Branches    40016    40014       -2     
==========================================
+ Hits       183595   183977     +382     
+ Misses      15956    15857      -99     
+ Partials     7995     7987       -8     
Files with missing lines Coverage Δ
lib/internal/cluster/primary.js 94.60% <100.00%> (+0.13%) ⬆️
lib/internal/cluster/round_robin_handle.js 95.80% <100.00%> (+0.12%) ⬆️
lib/internal/cluster/shared_handle.js 100.00% <100.00%> (ø)

... and 99 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@hgardneriv
Copy link

@islandryu - Thank you for proposing this change, the underlying issue is causing trouble for us with TCP, UDP, and HTTP servers: #60086. Any chance of getting this merged anytime in the near future?

@islandryu
Copy link
Member Author

We’ll need to get this reviewed before it can move forward.

@nodejs/cluster
would anyone be able to take a look?

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 the request-ci Add this label to start a Jenkins CI on a PR. label Jan 13, 2026
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jan 13, 2026
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@islandryu islandryu added commit-queue Add this label to land a pull request using GitHub Actions. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. labels Jan 14, 2026
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Jan 14, 2026
@nodejs-github-bot nodejs-github-bot merged commit 903f647 into nodejs:main Jan 14, 2026
73 of 74 checks passed
@nodejs-github-bot
Copy link
Collaborator

Landed in 903f647

@hgardneriv
Copy link

Thank you for merging this fix! We've been experiencing this issue in production and really appreciate the work that went into resolving it.

Would it be possible to backport this to the v22.x branch? The original issue (#60086) was reported against v22.14.0, and having this fix available in a v22.x release would be very helpful for those of us on the current LTS line.

Thanks again for your work on this!

aduh95 pushed a commit that referenced this pull request Jan 20, 2026
Fixes: #60086
PR-URL: #60141
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

cluster Issues and PRs related to the cluster subsystem. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Not all processes rebind when switching from :: to 0.0.0.0 or vice versa

4 participants