Repository navigation
fix(#11155): async waitCompletion() returns under a steady producer: it goes around again only for cascades its own workers schedule - #11191
Conversation
…it goes around again only for cascades its own workers schedule
|
Caution Review failedThe pull request is closed. Walkthrough
Merge Risk:
|
|
This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again. |
|
Review: LGTM overall.
No security concerns. |
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 0 |
🟢 Coverage 91.67% diff coverage · -4.62% coverage variation
Metric Results Coverage variation ✅ -4.62% coverage variation Diff coverage ✅ 91.67% diff coverage Coverage variation details
Coverable lines Covered lines Coverage Common ancestor commit (dca7a0e) 259676 227137 87.47% Head commit (6e9d845) 292513 (+32837) 242351 (+15214) 82.85% (-4.62%) Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch:
<coverage of head commit> - <coverage of common ancestor commit>Diff coverage details
Coverable lines Covered lines Diff coverage Pull request (#11191) 24 22 91.67% Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified:
<covered lines added or modified>/<coverable lines added or modified> * 100%
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
…ands submitted before it, not for none in flight
|
On the first minor point, I checked every production caller of The command-pool half of the barrier had the same starvation (CodeRabbit's finding); it is fixed in 6e9d845. |
|
Review of #11191: no blocking issues found.
Minor, non-blocking
No security concerns. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #11191 +/- ##
=========================================
Coverage 79.37% 79.37%
- Complexity 4963 4965 +2
=========================================
Files 2325 2325
Lines 259676 259686 +10
Branches 56891 56892 +1
=========================================
+ Hits 206119 206129 +10
Misses 32579 32579
Partials 20978 20978 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…er wait_completion() (#210) (#211) Engine 26.11.1-SNAPSHOT (ArcadeData/arcadedb#11191) ends waitCompletion() when the last marker releases the waiter, not on an isProcessing() poll, so a worker can still flag itself as executing for an instant after wait_completion() returns. Four tests asserted "idle now" at that point and failed on the nightly image. They now wait, with a deadline, for is_processing() to turn False. The wait_completion() docstring says what its return does and does not promise. Co-authored-by: Claude Opus 5.5 <[email protected]>
…returns (#11217) A worker counted the waitCompletion() marker's latch down before it dropped its executing-task flag, so isProcessing() asked right after the return answered true in up to half of the calls with nothing left to run (since #11191). The worker now drops the flag before completed() releases any waiter, and a dispatched command's in-flight count goes down before its sequence leaves the set the barrier waits on.
…it goes around again only for cascades its own workers schedule (#11191) * fix(#11155): async waitCompletion() returns under a steady producer: it goes around again only for cascades its own workers schedule * fix(#11155): the command half of the async barrier waits for the commands submitted before it, not for none in flight (cherry picked from commit 1188038)
…returns (#11217) A worker counted the waitCompletion() marker's latch down before it dropped its executing-task flag, so isProcessing() asked right after the return answered true in up to half of the calls with nothing left to run (since #11191). The worker now drops the flag before completed() releases any waiter, and a dispatched command's in-flight count goes down before its sequence leaves the set the barrier waits on. (cherry picked from commit 614090f)
Closes #11155.
Cause
Not a lock cycle. In the two thread dumps,
mainwaits on a differentCountDownLatcheach time, and its CPU time grows between them. So it keeps finishing passes ofwaitCompletion()and starting new ones, while the 3 workers work through an endless stream of tasks. ThetryLockFilesframe is just one sampled ordinary commit.DatabaseAsyncExecutorImpl.waitCompletionloopedwhile (isProcessing()). That is also true for tasks OTHER threads submit after the call began. The test's unrelated caller keeps all 3 queues full (one producer out-paces 3 workers on 4 CPUs), so every pass ends "still processing", for ever.GraphBatch.connectOutgoingEdgesParallel/connectIncomingEdgesParallelwait there for their own connect tasks, so the flush never ended.LocalDatabase.waitForAsyncCompletion(), the barrier of every index build (#6281), wrapped the same loop around it a second time.Fix
waitCompletiongoes around again only when a pass saw a cascade: a newLongAddercounts the tasks and commands scheduled by one of this executor's own workers (the Async cross-slot bidirectional edge: waitCompletion() can return before the in-edge is created, and a quiesce index build can miss it #6462 case). A cascade scheduled by a task queued before a marker lands in the counter before that marker fires, so an unchanged counter proves nothing was left behind the markers. Cost: one owner check per schedule, an increment only on worker-originated ones, no locks.waitForAsyncCompletion()is a singlewaitCompletion(). Tasks submitted by other threads during a build race it either way;quiesceAsync()is what keeps them out of a scan.DatabaseAsyncExecutor.waitCompletion()javadoc says what it waits for. Behaviour change: tasks other threads submit while it waits are no longer waited for. The docs are updated in the async API reference.Tests
New
Issue11155WaitCompletionUnderSteadyProducerTest: one worker and a producer that always queues the next task before the running one finishes, so the executor is never idle. Three tests, each with@Timeout(60)as a hang detector:waitCompletion()returns,waitForAsyncCompletion()returns, a GraphBatch parallel flush ends. Each also asserts that the task submitted before the wait completed, and that the producer was still active afterwards.Issue11155*, Issue5665*, Issue6462*, Issue6281*, Issue6303*, Issue10537*, Issue6526*, Issue6534*, GraphBatch*, DatabaseAsync*, *Async*Test, TransactionManager*, 225 tests, green.*IndexBuild*,*IndexBuilder*,CreateIndex*,*Quiesce*,LSMTreeIndexTest,TypeLSMTreeIndexTest,DropIndexTest): 172 tests, green.Left as is
async().newEdge) still moves the counter.awaitCommandsstill waits for zero in-flight DDL commands.Summary by CodeRabbit