Skip to content

fix(dispatcher): don't report busy when a request fails validation - #6055

Open
MIbtehajNasar wants to merge 1 commit into
nodejs:mainfrom
MIbtehajNasar:fix-6054-pool-stall-validation-error
Open

MIbtehajNasar wants to merge 1 commit into
nodejs:mainfrom
MIbtehajNasar:fix-6054-pool-stall-validation-error

Conversation

@MIbtehajNasar

Copy link
Copy Markdown

This relates to...

Fixes #6054

Rationale

When DispatcherBase.dispatch() rejects a request, for example because of an invalid header value, it returns false. Pool reads false as backpressure and marks the client as needing drain. The request was never queued, so the client never emits 'drain'. With connections: 1, every later request waits in the pool queue.

Changes

Features

N/A

Bug Fixes

  • After a rejected request, dispatch() returns false only when the dispatcher is closed or destroyed, because those never drain. A rejected request doesn't make the dispatcher busy, so in all other cases it returns true. This matches the documented meaning of false: busy until 'drain'.
  • PoolBase is the only reader of the return value in lib/: dispatch(), the drain handler and the resume loop. All three get the fix.
  • Added a test to test/pool.js: after a request with an invalid header, a pool with connections: 1 still sends the next request. On main the second request stays queued.

Breaking Changes and Deprecations

N/A

Status

DispatcherBase.dispatch() returned false whenever the request was
rejected, which Pool reads as backpressure. A request that fails
validation is never queued, so the client never emits 'drain' and Pool
never dispatches to it again.

Fixes nodejs#6054
@codecov-commenter

codecov-commenter commented Oct 20, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.57%. Comparing base (f4e4e45) to head (b53221c).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6055   +/-   ##
=======================================
  Coverage   91.57%   91.57%           
=======================================
  Files         113      113           
  Lines       43938    43940    +2     
=======================================
+ Hits        40235    40239    +4     
+ Misses       3703     3701    -2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 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.

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.

Pool permanently stalls after synchronous request validation errors

2 participants