Repository navigation
fix(dispatcher): don't report busy when a request fails validation - #6055
Open
MIbtehajNasar wants to merge 1 commit into
Open
MIbtehajNasar wants to merge 1 commit into
MIbtehajNasar wants to merge 1 commit into
Conversation
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 Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This relates to...
Fixes #6054
Rationale
When
DispatcherBase.dispatch()rejects a request, for example because of an invalid header value, it returnsfalse.Poolreadsfalseas backpressure and marks the client as needing drain. The request was never queued, so the client never emits'drain'. Withconnections: 1, every later request waits in the pool queue.Changes
Features
N/A
Bug Fixes
dispatch()returnsfalseonly 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 returnstrue. This matches the documented meaning offalse: busy until'drain'.PoolBaseis the only reader of the return value inlib/:dispatch(), the drain handler and the resume loop. All three get the fix.test/pool.js: after a request with an invalid header, a pool withconnections: 1still sends the next request. Onmainthe second request stays queued.Breaking Changes and Deprecations
N/A
Status