Repository navigation
tests: the sync fall-through test feeds the rest of the reply only after the poll has returned - #1153
Merged
Merged
Conversation
…r the poll has returned (Refs #1147 Refs #1104) A request is queued with syncMode still false, before the query sets it, so the feeder took a request that had not started polling for one that had fallen through, and fed the rest while the poll's own onRecv ran: a data race on the single-threaded reader, and 'unexpected DataRow in extended query' when the rest got in first (11 of 100 runs natively with -race, once on the macOS runner of #1151). partialSync closes polled after it delivered its part and the feeder waits for it. No product change.
|
Caution Review failedThe pull request is closed.
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. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
driver/postgres:
TestSyncFallThroughAfterTheCapKeepsOrderAndTheError1104raced on its own feeder, found on the macOS runner of #1151. A TEST race, not a product one. Refs #1147 Refs #1104The failure
CI run 40619726636, job 122590552041, required check "Portable fallback (macos-latest)", head
9a96459eof #1151 (green on its rerun):Cause
The fake event loop of the test (a goroutine) feeds the rest of the reply "once the caller has fallen through", which it decided by
pending[0].syncMode == false. But a request is put onpendingBEFORE the query setssyncModeto true (enqueue, thenreq.syncMode.Store(true)), so for a moment the request is queued with the flag still false: the feeder saw "fell through" before the poll had even started, and fed the rest while the poll's ownonRecvwas still running.protocol.Readeris single-threaded (the real worker guarantees it), so that is a data race on the reader's buffer inside the test, and when the rest got in first the extended-query parser saw a DataRow before ParseComplete and BindComplete: "unexpected DataRow in extended query (phase=0)". Not the product path: in the product the poll and the event loop's dispatch never overlap on a conn (the loop leaves the fd to the poll while it runs), which is also why the product fix of #1148 holds; the race exists only in the test's fake. The previous fix of this test (a timer, then the flag) had the same hole.Fix
partialSynccloses apolledchannel after it delivered its part; the feeder waits for it (20 s guard), and only then for the request to have left the sync mode (the caller clears it right after the poll returns). No product change.Evidence
Main (3d217a6), the unchanged test:
-race -count=100unexpected DataRow in extended query (phase=0))--cpus 2, six busy loops,-race -count=100This PR:
-race -count=100--cpus 2, six busy loops,-race -count=50--cpus 2,-race -count=50, all six1104testsunexpected DataRow in extended query (phase=0)if syncModegolangci-lint(CI pin v2.14): 0 issues.Release note
None (tests only).