You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ParallelScanSafetyTest can deadlock in a full-module run: caller-runs task blocks on a latch only a pool task can release #6568
com.arcadedb.query.sql.executor.ParallelScanSafetyTest.parallelScanCompletesWhileQueryPoolIsSaturated can deadlock outright during a full engine-module test run. Not a slow test - a hang, at 0% CPU, indefinitely.
Found while verifying #6379 (unrelated change, sparse-vector compaction only). Reproduced twice on an otherwise idle machine, so it is not simply CPU contention.
Evidence
jstack on the wedged Surefire fork:
"main" ... java.lang.Thread.State: WAITING (parking)
at java.util.concurrent.CountDownLatch.await(CountDownLatch.java:230)
at com.arcadedb.query.sql.executor.ParallelScanSafetyTest
.lambda$parallelScanCompletesWhileQueryPoolIsSaturated$1(ParallelScanSafetyTest.java:87)
at java.util.concurrent.FutureTask.run(FutureTask.java:317)
at com.arcadedb.utility.DedicatedThreadPool.runRejectedTask(DedicatedThreadPool.java:270)
at com.arcadedb.utility.DedicatedThreadPool.runOnCaller(DedicatedThreadPool.java:238)
That is a caller-runs latch deadlock: the pool rejects the task, runOnCaller executes it on the submitting thread, and the task then blocks on a CountDownLatch that only another pool task can count down. The submitter is now occupied by the task it was going to wait for.
Why it is worth fixing rather than ignoring
It presents in CI as a lane timeout with no failing assertion, so it looks like infrastructure trouble rather than a test problem, and the real cause is invisible without a thread dump from a wedged run.
It is load-dependent: the test passes alone in ~1.7s and passes immediately after an unrelated class, so it needs full-suite context. That makes it exactly the kind of failure that shows up rarely, on someone else's PR, and gets waved off.
slow-unit-tests is already near its 60-minute cap, so a lane that stalls here fails as a timeout with nothing to point at.
Worth checking beyond the test
The caller-runs saturation policy is production behaviour, not test-only. Whether an engine-internal caller-runs execution can ever block on something only that pool can complete is worth an audit - if it can, the same shape is reachable outside tests. See the engine-concurrency skill for the pool inventory and saturation policy.
Suggested
Either give the latch wait a bounded timeout and fail loudly, or have the test reserve its worker before saturating the pool so the counting-down task cannot be the one that gets rejected.
What was wrong. ArcadeDB's internal thread pools fall back to "run the task on the thread that submitted it" when they get overloaded. That fallback was being relied on as the thing that prevents a deadlock, and it isn't: it only kicks in once the pool's queue is completely full. With free slots in the queue the task is simply accepted and the submitting thread waits for it. If every worker in the pool is itself a thread waiting on a task it submitted, nothing in that pool can ever run again.
The symptom is the worst kind: the JVM sits at 0% CPU with no error, no failing test and nothing in the log. In CI it looks like an infrastructure timeout rather than a bug.
What changed. A thread that is about to wait for work it handed to a pool now takes that work back out of the queue and does it itself, instead of parking on it. Because a thread waiting for its own work always has something it can get on with, the whole fan-out is now guaranteed to finish - at any pool size, and however deeply the parallel work nests. This covers parallel graph algorithms (PageRank, connected components, BFS), the parallel Cypher operators and parallel scans.
Two related bugs turned up while doing this and were fixed too: shutting the server down with a query still running could leave background work writing into results the query had already given up on, and a query cancelled or timed out at the wrong moment could return a partial result reported as complete.
For operators. There's a new Reclaimed column on Studio's Server tab (and an arcadedb.executor.tasks.reclaimed metric). A non-zero value there is healthy - it means the pool was busy and a waiting caller pitched in. That's different from the Caller-Run Fallbacks column next to it, which means the pool was full and is the one worth acting on by raising the pool size.
No configuration change and no API change is needed.
❤️ Thanks for helping make ArcadeDB better! ArcadeDB is free and open source, sustained by its community. If it's useful to you or your company, please consider becoming a sponsor to keep development going.
Activity
test(#6568): bound the wedge verdict in stall-discounted time, not wa…
fix(#6568): a reclaim runs through runRejectedTask, the same hook a r…
test(#6568): await every pinned worker on the way out, and size the h…
docs(#6568): say why the reclaim is per index, and what the PoolStats…
fix(#6568): a fan-out on a shut-down pool fails and takes its outstan…
fix(#6568): an interrupted waiter aborts instead of reclaiming a chun…
test(#6568): record what the shared-pool pinning discipline rests on
Merge pull request #6739 from ArcadeData/fix/6568-parallelscan-caller…
lvca commentedon Aug 26, 2026
Fixed in #6739.
What was wrong. ArcadeDB's internal thread pools fall back to "run the task on the thread that submitted it" when they get overloaded. That fallback was being relied on as the thing that prevents a deadlock, and it isn't: it only kicks in once the pool's queue is completely full. With free slots in the queue the task is simply accepted and the submitting thread waits for it. If every worker in the pool is itself a thread waiting on a task it submitted, nothing in that pool can ever run again.
The symptom is the worst kind: the JVM sits at 0% CPU with no error, no failing test and nothing in the log. In CI it looks like an infrastructure timeout rather than a bug.
What changed. A thread that is about to wait for work it handed to a pool now takes that work back out of the queue and does it itself, instead of parking on it. Because a thread waiting for its own work always has something it can get on with, the whole fan-out is now guaranteed to finish - at any pool size, and however deeply the parallel work nests. This covers parallel graph algorithms (PageRank, connected components, BFS), the parallel Cypher operators and parallel scans.
Two related bugs turned up while doing this and were fixed too: shutting the server down with a query still running could leave background work writing into results the query had already given up on, and a query cancelled or timed out at the wrong moment could return a partial result reported as complete.
For operators. There's a new
Reclaimedcolumn on Studio's Server tab (and anarcadedb.executor.tasks.reclaimedmetric). A non-zero value there is healthy - it means the pool was busy and a waiting caller pitched in. That's different from theCaller-Run Fallbackscolumn next to it, which means the pool was full and is the one worth acting on by raising the pool size.No configuration change and no API change is needed.
❤️ Thanks for helping make ArcadeDB better! ArcadeDB is free and open source, sustained by its community. If it's useful to you or your company, please consider becoming a sponsor to keep development going.
fix(ArcadeData#6568): a wait for a task on a dedicated pool reclaims …