Skip to content

Property path with both ends unbound builds its whole closure outside the memory budget #1983

Open

Description

@bplatz

A property path with neither end bound (?s ex:p+ ?o, ?s ex:p* ?o) runs PropertyPathOperator::compute_closure in fluree-db-query/src/property_path.rs, and nothing bounds what it builds:

  • an adjacency map and node set over every edge of the path's predicates (for a wildcard path, every node-to-node edge in the graph);
  • a Vec of every (start, reachable) pair, which is quadratic in the worst case;
  • for composite paths (?s (ex:a/ex:b)+ ?o), a separate traversal from each start node.

None of this calls ctx.record_alloc or ctx.checkpoint(). The query memory budget can't stop it and cancellation isn't checked, so on a large enough graph the query ends in the process OOM killer instead of a budget error.

History

Until #1959 the module docs said the both-unbound case was "intentionally an error to prevent accidental full-closure enumeration". The code never enforced that: the (None, None) dispatch already called compute_closure. #1959 corrected the docs; this issue is for the missing guard. Raised in review: #1959 (comment)

Options

  • Minimum: charge the adjacency map, node set and output pairs to the memory budget (record_alloc plus a periodic checkpoint), so an oversized closure fails with a budget error and can be cancelled.
  • Stream pairs from one start node at a time instead of materializing the whole output first.
  • Log a warning when an unbounded closure runs, so it's visible before it becomes an incident.

Related

#1973 is another query shape that ends in OOM rather than a budget error: OPTIONAL with a left-bound variable in object position.

Activity

  1. added
    bug
    P2
    area:query
    performance
    on Sep 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2area:querybugperformance

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions