Skip to content

fix: avoid OOM in CachedInputFileSystem when duration is Infinity#527

Merged
alexander-akait merged 2 commits intomainfrom
claude/fix-issue-368-aW3az
Apr 17, 2026
Merged

fix: avoid OOM in CachedInputFileSystem when duration is Infinity#527
alexander-akait merged 2 commits intomainfrom
claude/fix-issue-368-aW3az

Conversation

@alexander-akait
Copy link
Copy Markdown
Member

When duration is Infinity, the constructor's level-allocation loop
(for (let i = 5000; i < duration; i += 500)) never terminates, which
crashes the process with an out-of-memory error before any file is even
resolved. Additionally, scheduling a decay setTimeout with an infinite
timeout would be meaningless (and clamped by Node).

Guard both the level allocation and the async decay timer so that passing
Infinity yields a never-expiring cache, as users would expect.

Closes #368

When `duration` is `Infinity`, the constructor's level-allocation loop
(`for (let i = 5000; i < duration; i += 500)`) never terminates, which
crashes the process with an out-of-memory error before any file is even
resolved. Additionally, scheduling a decay `setTimeout` with an infinite
timeout would be meaningless (and clamped by Node).

Guard both the level allocation and the async decay timer so that passing
`Infinity` yields a never-expiring cache, as users would expect.

Closes #368
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 16, 2026

🦋 Changeset detected

Latest commit: c3c953c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
enhanced-resolve Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@linux-foundation-easycla
Copy link
Copy Markdown

linux-foundation-easycla Bot commented Apr 16, 2026

CLA Not Signed

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 16, 2026

Codecov Report

❌ Patch coverage is 80.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 96.72%. Comparing base (b5259a0) to head (c3c953c).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
lib/CachedInputFileSystem.js 80.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #527      +/-   ##
==========================================
- Coverage   96.75%   96.72%   -0.04%     
==========================================
  Files          50       50              
  Lines        2589     2593       +4     
  Branches      788      790       +2     
==========================================
+ Hits         2505     2508       +3     
- Misses         69       70       +1     
  Partials       15       15              
Flag Coverage Δ
integration 96.72% <80.00%> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Apr 16, 2026

Merging this PR will not alter performance

✅ 43 untouched benchmarks


Comparing claude/fix-issue-368-aW3az (c3c953c) with main (b5259a0)

Open in CodSpeed

@alexander-akait alexander-akait merged commit db3c6b8 into main Apr 17, 2026
31 of 34 checks passed
@alexander-akait alexander-akait deleted the claude/fix-issue-368-aW3az branch April 17, 2026 11:37
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.

CachedInputFileSystem OOM when duration is infinity

2 participants