Skip to content

fix(cluster): use a separate HTTP server for debugPort - #6073

Open
dvd233 wants to merge 1 commit into
eggjs:mainfrom
dvd233:codex/fix-http-debug-port
Open

dvd233 wants to merge 1 commit into
eggjs:mainfrom
dvd233:codex/fix-http-debug-port

Conversation

@dvd233

@dvd233 dvd233 commented Oct 9, 2026 •

Copy link
Copy Markdown

Configuring debugPort for a plain HTTP application calls listen() twice on the same HTTP server, preventing both configured endpoints from becoming usable. Create a separate HTTP server for the debug listener, matching the existing HTTPS path.

Add real cluster regression coverage for HTTP with the default hostname, HTTP with an explicit hostname, and HTTPS with an HTTP debug port. Each case requests both endpoints and verifies that both ports are released after shutdown.

Validation on Node.js 22.23.2:

  • Focused Vitest run: debug-port.test.ts, worker-protocol.test.ts, and https.test.ts — 20 tests passed. The new regression was also rerun after final test cleanup — 3 tests passed.
  • Before the production fix, the two HTTP regression cases timed out; the HTTPS case passed.
  • Cluster package tsc --noEmit, touched-file oxlint --type-aware --type-check, and oxfmt --check passed.

The focused tests used the package's Vitest entry point and original configuration directly because the local Windows utoo launcher failed before starting Vitest. A full monorepo/CI run was not performed.

Summary by CodeRabbit

  • Bug Fixes
    • HTTP workers with a configured debug port now serve debug traffic through a separate HTTP server, keeping the application and debug endpoints available independently.

Copilot AI balanced review requested due to automatic review settings October 9, 2026 14:03

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 44e20f9e-42ba-402c-824c-d02affde29d0

📥 Commits

Reviewing files that changed from the base of the PR and between e9cc326 and dce17f8.


📒 Files selected for processing (5)
  • packages/cluster/src/worker_protocol/app.ts
  • packages/cluster/test/debug-port.test.ts
  • packages/cluster/test/fixtures/apps/http-debug-server/app/router.js
  • packages/cluster/test/fixtures/apps/http-debug-server/config/config.default.js
  • packages/cluster/test/fixtures/apps/http-debug-server/package.json

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.



📝 Walkthrough

Walkthrough

HTTP workers with a configured debug port now use a separate HTTP server instead of the application server. New cluster tests cover HTTP and HTTPS endpoints, hostname settings, and port closure after app shutdown.

Changes

HTTP debug server

Layer / File(s) Summary
Separate debug server and test fixture
packages/cluster/src/worker_protocol/app.ts, packages/cluster/test/fixtures/apps/http-debug-server/*
HTTP workers with debugPort now use a separate HTTP server. The fixture configures the listener hostname and responds to GET /.
Endpoint and shutdown tests
packages/cluster/test/debug-port.test.ts
Tests cover HTTP with unset and explicit hostnames, HTTPS, responses from both ports, and port closure after the app stops.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix


Merge Risk: ⚪ Minimal · up to dce17

HTTP applications with a configured debug port no longer call listen() twice on the same server. No concrete merge risk was found, and the new cluster tests cover the changed behavior.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 4 files. (1 skipped: 1… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: using a separate HTTP server for the cluster debug port.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.

Full details: Docstring Coverage

Explanation

Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 4 files. (1 skipped: 1 unsupported.)



  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR


  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants