Skip to content

GraphData.weightedAdjacencyFromColumns's per-node WorkGuard checkpoint cannot abort mid-supernode (provider.edgeWeightsOf has no interrupt hook) #6715

Closed

Description

@lvca

Raised in review of PR #6714 (issues #6316/#6265/#6318/#6705) and deliberately not folded into it: it names a real, pre-existing architectural gap that predates that PR and would need an SPI-level change larger than a review-response round should attempt.

The gap

AbstractAlgoProcedure.GraphData.weightedAdjacencyFromColumns throttles its WorkGuard per node:

for (int i = 0; i < nodeCount; i++) {
  guard.checkPeriodically(i);
  final NodeEdgeWeights edges = provider.edgeWeightsOf(i, dir, weightProperty, 1.0, types);
  ...
}

GraphTraversalProvider#edgeWeightsOf's default implementation (the only one; GraphAnalyticalView does not override it) is O(degree) with no checkpoint of its own:

default NodeEdgeWeights edgeWeightsOf(...) {
  ...
  for (final String type : types)
    for (final Vertex.DIRECTION d : directions) {
      final int[] slice = getNeighborIds(nodeId, d, type);
      ...
      for (int j = 0; j < slice.length; j++) {
        // no interrupt/timeout check anywhere in this loop
      }
    }
}

So a single call for a supernode (a vertex with a very large fan-out) is one unabortable unit of work: once entered, nothing can stop it until it returns, regardless of arcadedb.command.timeout or a thread interrupt.

Why it's newly relevant

The helper itself is not new - algo.steinerTree and algo.bellmanFord already read weights through it. What #6316 changed is that four more procedures (algo.mst, algo.msa, algo.maxFlow, algo.kShortestPaths) can now reach this same columnar path when a Graph Analytical View has the weight property materialized as a column, where previously they always used a hand-rolled OLTP walk with genuinely per-edge WorkGuard throttling (guard.checkPeriodically(edgeStep++), one increment per edge - visible in the pre-#6316 version of e.g. AlgoMST, which had a comment specifically about this: "Throttled by EDGE rather than by vertex: a near-star graph puts millions of edges inside a single vertex iteration, and a per-vertex checkpoint would leave that whole node unabortable"). That protection is preserved in weightedAdjacencyFromRecords (the record-based fallback, still per-edge) but not in the columnar path six procedures now share.

Why not fixed in #6714

A correct fix needs a checkpoint hook inside provider.edgeWeightsOf's own O(degree) loop, which means either:

  • widening GraphTraversalProvider's SPI to accept a WorkCheckpoint/similar and pushing the per-edge check into every implementer (the interface's only implementation today is the default method, but it's still an SPI contract change), or
  • restructuring the columnar build to pull neighbour/weight slices in bounded chunks rather than one array-returning call per node.

Either is a real design decision (chunk size, whether the check belongs in the SPI vs. the caller, whether it costs anything on the hot path for the common non-supernode case) that deserves its own review, not a fix bundled into an already-large PR whose own scope is CSR routing and buffer reuse.

Suggested shape

Mirror what issue #6318 did for GraphAlgorithms.localClusteringCoefficient's two parallel phases: give edgeWeightsOf (or a new bulk variant of it) a WorkCheckpoint-shaped hook, called at a bounded stride inside its per-edge loop, and thread a checkpoint from weightedAdjacencyFromColumns through it. That keeps the "checkpoint stays on a single logical thread of control, called between chunks" contract #6318 established, applied one level deeper.

Related

#6316, #6318, #6301, PR #6714.

Activity

  1. added this to the 26.9.1 milestone on Aug 25, 2026
  2. self-assigned this
    on Aug 25, 2026
  3. added
    in progress
    and removed
    in progress
    on Aug 25, 2026
  4. lvca commented on Aug 25, 2026

    @lvca
    MemberAuthor

    PR #6714 review round 9 added a sharper angle on this same gap: it's not only an abort-latency issue but a memory-budget one too. provider.edgeWeightsOf(i, ...) fully materializes neighbors[i]/weights[i] for node i before weightedAdjacencyFromColumns's reserveWeightedAdjacency gets a chance to check the accumulated entries count against CYPHER_ALGO_MAX_WORKING_MEMORY - so a single supernode's arrays can already exceed the configured budget before the next checkpoint/reservation fires. Same root cause (no hook inside edgeWeightsOf's own O(degree) loop), same fix (a checkpoint/reservation hook inside that loop) - just a second, and arguably sharper (OOM risk, not only slow abort), consequence worth keeping in mind when this gets picked up.

  5. added
    in progress
    on Aug 25, 2026
  6. removed
    in progress
    on Aug 25, 2026
  7. lvca commented on Aug 25, 2026

    @lvca
    MemberAuthor

    Fixed in #6717 (merged).

    When a graph algorithm query ran over a Graph Analytical View and hit a "supernode" (a vertex with a very large number of edges), the query could not be aborted or timed out while processing that one node, and its memory usage wasn't checked against the configured working-memory limit either. Both are now fixed: the query can be interrupted or hit its timeout mid-node instead of only between nodes, and memory usage is checked as it accumulates.


    ❤️ 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.

  8. added a commit that references this issue on Aug 25, 2026
  9. added a commit that references this issue on Aug 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions