Skip to content

fix: close hot transport on plugin shutdown - #5781

Open
Nirmalsiddh wants to merge 1 commit into
webpack:mainfrom
Nirmalsiddh:fix/plugin-hot-transport-shutdown
Open

Nirmalsiddh wants to merge 1 commit into
webpack:mainfrom
Nirmalsiddh:fix/plugin-hot-transport-shutdown

Conversation

@Nirmalsiddh

@Nirmalsiddh Nirmalsiddh commented Oct 26, 2026 •

Copy link
Copy Markdown

Summary

When webpack-dev-server runs as a webpack plugin, compiler.close() can stop the HTTP server while leaving a separately listening built-in WebSocket endpoint accepting connections and sending heartbeats.

Close middleware-owned built-in hot transports during plugin shutdown while leaving compiler watching to its host.

Changes

  • Close built-in hot coordinators without invoking ordinary middleware shutdown or duplicating custom transport cleanup.
  • Add regression coverage for listener release, existing client closure, heartbeat termination, natural process exit, and watcher ownership.
  • Cover SSE and disabled-hot overrides, custom transport ownership, and helper failure paths.
  • Add a patch changeset.

Testing

  • 17 targeted tests passed, covering shutdown, MultiCompiler, WebSocket/SSE behavior, and helper failure paths.
  • The four regression/ownership cases passed again before committing.
  • Targeted ESLint and Prettier checks passed.
  • TypeScript, changeset validation, and Git diff checks passed.
  • The shutdown regression failed before the production correction and passed afterward.

Limitations

The full repository suite and browser-dependent tests were not run locally. Hosted CI has not run against this contribution.

Summary by CodeRabbit

  • Bug Fixes
    • Built-in WebSocket and server-sent event connections now close when a plugin-managed compiler shuts down, including WebSocket endpoints listening separately.
    • Host-owned compiler watching remains active when a plugin-managed compiler shuts down.

@changeset-bot

changeset-bot Bot commented Oct 26, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: a160fe1

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
webpack-dev-server Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@linux-foundation-easycla

linux-foundation-easycla Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: Nirmalsiddh / name: Nirmal Siddh (a160fe1)

@coderabbitai

coderabbitai Bot commented Oct 26, 2026

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a30beb18-5c86-47d5-9bac-99620715ef02
Commits

Reviewing files that changed from the base of the PR and between d78f183 and a160fe1.

Files selected for processing: 4
  • .changeset/quiet-hot-shutdown.md
  • lib/Server.js
  • test/e2e/api-plugin.test.js
  • test/helpers/plugin-transport-shutdown.js

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

Walkthrough

Plugin-mode shutdown now closes and clears the middleware-owned built-in WebSocket or SSE transport. The added test helper observes HTTP and WebSocket behavior before and after shutdown. End-to-end tests cover shutdown outcomes, cleanup failures, and transport ownership.

Priority: Normal

Merge Risk: Low · up to a160f

An immediate restart may briefly find the hot WebSocket port occupied. This is a bounded risk that does not otherwise prevent merging.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "fix: close hot transport on plugin shutdown" matches the main change. The PR closes the middleware-owned built-in hot transport (WebSocket or SSE) when a plugin compiler shuts down, and the…
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 3 files. (1 skipped: 1 …
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: Title check

Explanation

The title "fix: close hot transport on plugin shutdown" matches the main change. The PR closes the middleware-owned built-in hot transport (WebSocket or SSE) when a plugin compiler shuts down, and the changeset, lib/Server.js change, and tests all cover this. The title is short, uses a conventional prefix, and names the primary behavior. It does not describe the preserved compiler watching or the test helper, which is expected for a title.

Full details: Docstring Coverage

Explanation

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

Finishing Touches: 💡 1
🛠️ Fix failing CI checks: 💡
  • Commit to this branch
  • Create a new PR
🧪 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.

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.

1 participant