Repository navigation
fix: a repeated cancel's refusal also comes before the query's HY008 - #496
Merged
Merged
Conversation
#495 held a native result until the accepted cancel's callback had run, but not the refusal of a repeated cancel. On CI after the merge, cancel/again-after-confirm-at-100 still failed once: the second cancel, sent from the first cancel's callback, is refused a tick on (setImmediate), and the fetch's HY008 landed in the poll phase in between. With nothing pending any more, it ran first. The notifier now counts every cancel callback still to run, accepted or refused, and releases what waits once the count is back to 0. test/cancel-order.test.js pins the order with a stub connection and no server. Its first case uses process.nextTick from the cancel callback to put the result exactly where CI saw it: it fails on #495's notifier and passes with this one. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
Follow-up to #495. After that merge,
cancel/again-after-confirm-at-100failed once more on Linux CI (run):Cause
#495 held native results until the accepted cancel's callback had run, but not for the refusal of a repeated cancel. The sequence that slipped through:
setImmediate, so it runs in the next loop iteration's check phase.HY008completion lands in the poll phase, before that check phase. Nothing is pending any more, so it runs straight away, ahead of the refusal.Fix
The notifier now counts every cancel callback still to run, accepted or refused (
holdForCancel). It releases what is waiting one tick after the count gets back to 0.Test
test/cancel-order.test.jsuses a stub connection and needs no server. Its first case reproduces the CI interleaving deterministically: aprocess.nextTickregistered from the cancel callback runs after that callback but before the refusal'ssetImmediate.Local runs (WSL, SQL Server 2022): contract, replay,
cancel-order,cancel-regression,querycancelandcancel-stress, 386 passing.🤖 Generated with Claude Code