Skip to content

src: unlink compile cache temp file on persist failure - #65476

Open
lazerg wants to merge 1 commit into
nodejs:mainfrom
lazerg:fix/issue-65473-compile-cache-tmp-file-leak
Open

src: unlink compile cache temp file on persist failure#65476
lazerg wants to merge 1 commit into
nodejs:mainfrom
lazerg:fix/issue-65473-compile-cache-tmp-file-leak

Conversation

@lazerg

@lazerg lazerg commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

When persisting the compile cache fails after the temporary file is created, on write, close, or rename failure, CompileCacheHandler::Persist() moves on without closing the descriptor or removing the temporary file. Under an EDQUOT/ENOSPC/EFBIG condition this leaves zero-byte temp files (and open descriptors) behind for every failed write. This adds a scope guard that closes the descriptor if still open and unlinks the temporary file unless the rename succeeded.

Fixes #65473

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. labels Aug 22, 2026
Signed-off-by: Lazizbek Ergashev <lazerg2@gmail.com>
@lazerg
lazerg force-pushed the fix/issue-65473-compile-cache-tmp-file-leak branch from a4057bd to 11b60ed Compare August 22, 2026 02:05
@codecov

codecov Bot commented Aug 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.11%. Comparing base (5fc9f1f) to head (11b60ed).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #65476      +/-   ##
==========================================
- Coverage   90.13%   90.11%   -0.03%     
==========================================
  Files         751      751              
  Lines      252409   252435      +26     
  Branches    47478    47471       -7     
==========================================
- Hits       227507   227473      -34     
- Misses      16208    16263      +55     
- Partials     8694     8699       +5     
Files with missing lines Coverage Δ
src/compile_cache.cc 81.44% <100.00%> (+1.69%) ⬆️

... and 34 files with indirect coverage changes

🚀 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

module: compile cache leaks temporary files when persistence fails

2 participants