Skip to content

fix(include-parser): infinite recursion or out-of-memory with symlinks/large projects - #1598

Merged
firecow merged 2 commits into
firecow:masterfrom
superewald:fix-include-filescan
Jul 28, 2025
Merged

fix(include-parser): infinite recursion or out-of-memory with symlinks/large projects#1598
firecow merged 2 commits into
firecow:masterfrom
superewald:fix-include-filescan

Conversation

@superewald

@superewald superewald commented Jun 30, 2025

Copy link
Copy Markdown
Contributor

The ParserIncludes.memoLocalRepoFiles function used globby to memoize/cache the repository filenames. Since globby expands /project to /project/**/* this would potentially cache immense amounts of filepaths that are useless for the context. If the repository contains local symlinks this can easily lead to the OOM crash described in #1588.

This commit adds the Utils.getTrackedFiles function that uses git ls-files to return the list of tracked files for the specific project, acknowledging .gitignores and avoiding untracked files to be memoized.

Fixes #1588

@superewald
superewald marked this pull request as draft June 30, 2025 15:11
@superewald
superewald force-pushed the fix-include-filescan branch from efa7459 to 1da981e Compare July 1, 2025 09:39
@superewald
superewald marked this pull request as ready for review July 1, 2025 09:50

@firecow firecow left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@firecow
firecow merged commit d67c9bb into firecow:master Jul 28, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JavaScript heap out of memory when using include with local or remote templates

2 participants