Skip to content

Dense changed-file recovery sync hits V8's spread-argument limit #1558

Description

@netbrah

Summary

A recovery sync with roughly 98,000 newly parsed C/C++ files reached 100% and
then exited with:

Failed to sync: Maximum call stack size exceeded

The CLI prints only err.message, so the actual stack was unavailable. Source
inspection points to an unbounded result-array spread in
QueryBuilder.getUnresolvedReferencesByFiles():

const chunkRows = statement.all(...chunk);
rows.push(...chunkRows);

The input path chunk is kept below SQLite's parameter limit (about 900 paths),
but the number of unresolved-reference rows returned for those paths is not
bounded. A dense C/C++ chunk can therefore pass more arguments to
Array.prototype.push than V8 allows.

Suggested direction

Append chunkRows with a loop or bounded slices instead of spreading an
unbounded query result. Separately, please expose a full stack under a debug
flag; message-only CLI errors make it difficult to confirm failures in a
specific large-array boundary.

I am labeling the spread site as the source-level hypothesis because the CLI
discarded the stack. The externally observed failure itself is reproducible
after the same dense changed-file batch.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions