Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Unbounded recursion in minusWherePredicates / isWhereSubsetInternal overflows the stack under rapid on-demand subset churn #1591

Copy link
Copy link

Description

@simonstaffgenius
Issue body actions
  • I've validated the bug against the latest version of DB packages

Describe the bug
Rapidly fetching on-demand subsets (e.g. while scrolling a virtualized view that re-windows on every scroll) throws RangeError: Maximum call stack size exceeded. The stack points into query/predicate-utils.jsminusWherePredicates and isWhereSubsetInternal, which are mutually recursive and have no depth bound.

To Reproduce
Steps to reproduce the behavior:

  • Trigger is rapid window churn against an on-demand collection whose subset where carries an IN/= ANY clause.
  • A Node harness importing the real DeduplicatedLoadSubset reproduces the predicate accumulation, but the overflow needs the join-derived IN clause plus realistic async live-query timing to manifest.

Suggested fix

A depth guard on the mutually recursive walkers that bails conservatively (minusnull, isWhereSubsetfalse) so a too-deep case just costs a redundant re-request rather than crashing. Better still would be flattening the inor handling so the subtraction doesn't recurse per disjunct.

Desktop:

  • OS: macOS 26 Tahoe
  • Browser chrome, safari, firefox
  • Version 0.6.8
Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.