lehtoroni / lmath-issues

A repository for tracking issues in the L'Math software.
3 stars 0 forks source link

Purging of redundant bundles fails and can cause other actions to fail [== r1.10.7] #82

Closed lehtoroni closed 1 month ago

lehtoroni commented 1 month ago

Purging of redundant update bundles fails due to temporarily disabling asar support, if required modules haven't been loaded yet, or if other actions are being run at the same time.

[2024-09-11T08:12:21.551] [INFO] default - Found 1 redundant and 1 broken version bundles
[2024-09-11T08:12:21.551] [INFO] default - Removing redundant/broken bundle: C:\Users\...\AppData\Local\lmath-bootstrap\r1.10.6
[2024-09-11T08:12:21.559] [ERROR] default - Error while purging version bundles: Error: EBUSY: resource busy or locked, rmdir 'C:\Users\...\AppData\Local\lmath-bootstrap\r1.10.6'
[2024-09-11T08:12:22.375] [ERROR] default - Generic error: Error: Cannot find module 'fs-extra'
Require stack:
- C:\Users\...\AppData\Local\lmath-bootstrap\r1.10.7\resources\app.asar\dist\module\updates.js
- C:\Users\...\AppData\Local\lmath-bootstrap\r1.10.7\resources\app.asar\dist\app.js
- C:\Users\...\AppData\Local\lmath-bootstrap\r1.10.7\resources\app.asar\index.js
- 
lehtoroni commented 1 month ago

This issue happens because of a recklessly chosen behaviour on bundle deletion:

process.noAsar = true;
await fsp.rm(bundlePath, { recursive: true, force: true });
process.noAsar = false;

Thus, if the removal fails for any reason, process.noAsar will never be set back to false, and the app will not load any previously unloaded modules correctly.

lehtoroni commented 1 month ago

Should be fixed in 1.10.8.