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
WHERE-less aggregation/ORDER BY/DISTINCT over a plain scan ignores arcadedb.command.timeout (plain scan sources carry no WorkGuard) #6465
A query with no WHERE clause and no explicit SQL TIMEOUT clause that feeds a blocking consumer (aggregation, ORDER BY, DISTINCT) drains the whole type server-side with nothing consulting arcadedb.command.timeout. The plain scan sources carry no WorkGuard, and the blocking consumers honor only the legacy TIMEOUT-clause value, not the command deadline.
Where (HEAD 0291182af)
Unguarded scan sources (zero WorkGuard/getCommandDeadline references): engine/src/main/java/com/arcadedb/query/sql/executor/FetchFromTypeExecutionStep.java (sequential path), FetchFromClusterExecutionStep.java, FetchFromClustersExecutionStep.java, FetchFromIndexStep.java, FetchFromIndexValuesStep.java, FetchFromRidsStep.java. Only ScanWithFilterStep/FilterStep (used when a WHERE exists) are guarded.
Blocking consumers honoring only the legacy TIMEOUT clause (timeoutMillis, not the command deadline): AggregateProjectionCalculationStep.java:129-130, OrderByStep.java:113-114; DistinctExecutionStep.java:124 honors no timeout at all. info.timeout is only the explicit SQL TIMEOUT clause (SelectExecutionPlanner.java:148-154), so with no clause timeoutMillis == -1 and the legacy check is disabled — while the planner comment claims the command deadline is "carried ... [where] no statement kind can miss" it.
Repro (server has arcadedb.command.timeout set, no per-query TIMEOUT clause)
SELECT max(x) FROM HugeType (or sum/avg/any GROUP BY, no WHERE) — the aggregate drains the unguarded scan past the deadline.
SELECT FROM HugeType ORDER BY x — ORDER BY accumulates the unguarded scan (only bounded by QUERY_MAX_HEAP_ELEMENTS_ALLOWED_PER_OP, not by time).
SELECT DISTINCT lowCardinalityField FROM HugeType — one next() scans the whole table inside a single fetchNext with no check.
(SELECT count(*) FROM HugeType is safe — O(1) CountFromTypeStep.)
Suggested fix
Add WorkGuard.forCommandDeadline(context) + guard.checkPeriodically() to the plain scan iterators, or have the blocking consumers guard their drain loops on the command deadline (not just timeoutMillis).
Scope / confidence
Medium — behavior is certain (the plain-scan sources have no guard, verified); the only open question is whether the authors consider the WHERE-less + blocking case in scope, but their own "no statement kind can miss the deadline" comment says it should be. Distinct from #5886 and #6373.
If you set a server-wide query timeout (arcadedb.command.timeout) and ran a query with no WHERE clause that also needed aggregation, ORDER BY, or DISTINCT (e.g. SELECT max(x) FROM HugeType), the timeout was silently ignored - the query could run to completion no matter how long it took. Queries with a WHERE clause were already correctly bounded by the timeout. Now every plain full-table/index scan respects the configured timeout too.
❤️ 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
lvca commentedon Aug 24, 2026
Fixed in #6662 (merged).
If you set a server-wide query timeout (
arcadedb.command.timeout) and ran a query with noWHEREclause that also needed aggregation,ORDER BY, orDISTINCT(e.g.SELECT max(x) FROM HugeType), the timeout was silently ignored - the query could run to completion no matter how long it took. Queries with aWHEREclause were already correctly bounded by the timeout. Now every plain full-table/index scan respects the configured timeout too.❤️ 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: DISTINCT/UNION key collisions, WITH * internal vars, and missing…