Repository navigation
fix: re-extract asar entries whose temporary copy was removed - #52807
codebytere wants to merge 2 commits into
Conversation
Archive::CopyFileOut() caches the temporary copy it extracts for each entry and returned the cached path without checking that the file is still there. Archives live for the whole process, so once the OS cleans the temp directory under a long-running app (macOS sweeps $TMPDIR periodically) every later fs.open/createReadStream/execFile of that entry failed with ENOENT while readFile kept working. Check the cached copy exists and extract the entry again when it does not. Closes #52804.
6a0b93e to
ebdb1bc
Compare
|
@codebytere I see that #52811 looks like it was a testing bug you ran into after creating this PR, and that it landed; but from what I saw there, it didn't look like it contained this PR or a related fix; so I am curious why you closed this PR, if there is another newer/rebased/etc version of this fix I should be watching for; and/or whether you just found that this wasn't actually a good solution to #52804, etc Edit: After exploring with GitHub Copilot (GPT-5.6 Terra), I believe this may have been closed because there is a more broader PR related to ASAR file improvements/etc:
|
Description of Change
Closes #52804.
Archive::CopyFileOut()caches the temporary copy it extracts for each entry and returned the cached path without checking the file was still there. Since #29293 archives live for the whole process, so once the OS cleans the temp directory under a long-running app (macOS sweeps$TMPDIRperiodically) every laterfs.open/createReadStream/execFileof that entry failed withENOENT, whilereadFilekept working through the retained archive handle. The cache hit now checks the copy exists and extracts the entry again when it doesn't.Checklist
npm testpassesRelease Notes
Notes: Fixed an issue where reading a file inside an asar archive with
fs.createReadStreamorchild_processcould fail with ENOENT in long-running apps after the OS cleared the temporary directory.