Repository navigation
fix(#11212): the async executor counts as idle once waitCompletion() returns - #11217
Conversation
…returns 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.
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
|
Review: LGTM.
I did not run the tests. No performance or security concerns. |
|
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. |
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 0 |
🟢 Coverage 100.00% diff coverage
Metric Results Coverage variation Report missing for b34a11b1 Diff coverage ✅ 100.00% diff coverage Coverage variation details
Coverable lines Covered lines Coverage Common ancestor commit (b34a11b) Report Missing Report Missing Report Missing Head commit (4441919) 292661 242490 82.86% 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 (#11217) 4 4 100.00% 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%1 Codacy didn't receive coverage data for the commit, or there was an error processing the received data. Check your integration for errors and validate that your coverage setup is correct.
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.
|
Verified with the repro from #11212 (
Head: |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #11217 +/- ##
============================================
- Coverage 79.39% 79.37% -0.02%
- Complexity 4960 4973 +13
============================================
Files 2325 2325
Lines 259803 259834 +31
Branches 56925 56937 +12
============================================
- Hits 206261 206236 -25
- Misses 32548 32588 +40
- Partials 20994 21010 +16 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…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)
Fixes #11212.
Problem
Since #11191
waitCompletion()returns when the last marker counts its latch down.AsyncThread.executeTaskcalledmessage.completed()(the countdown) beforeexecutingTask.set(nested), soisProcessing()asked right after the return could answertruewith nothing left to run (5-48% of calls in the reporter's measurements). Dispatched commands had the same gap:commandCompleted()removed the sequence the barrier waits on before decrementing the countisProcessing()reads.Fix
executeTask:completedTaskCount++and the flag reset now happen beforecompleted(), for every task. Everycompleted()override only signals a waiter (latch countdown, park signal), so whoever it releases - thewaitCompletion()marker,scanType(), a browse iterator - finds the worker idle.commandCompleted(): count first, then the set, the mirror ofsubmitCommand()'s order.waitCompletion()/isProcessing()states the restored post-condition, and thatisProcessing()stays a point-in-time answer (it is not a durability predicate, and a task being taken off a queue at that instant can be missed while others submit).This keeps the old post-condition rather than only documenting its loss, as the reporter offered: it is free (a reordering, no new state) and callers such as the Python bindings relied on it.
Tests
Issue11212IdleAfterWaitCompletionTest:aTaskCompletionIsSignalledOnlyOnceTheWorkerCountsAsIdle: deterministic, asksisProcessing()from insidecompleted()(failed before the fix).idleRightAfterWaitCompletionOfDispatchedCommands: 100 async DDL commands (failed before the fix).scanType().Ran 270 tests (all
com.arcadedb.database.asynctests plus every*Async*,*GraphBatch*,Issue5665*and*WaitCompletion*engine test): all green.Summary by CodeRabbit