Open davidliudev opened 2 years ago
Need either to patch the original lockfile lib (which the owner already archived it), or probably should fork that lib and fix this issue.
Hm, it might make sense to vendor lockfile
through https://github.com/jviotti/vendorpull. I'll send a PR to do this, and then we can try to land a lockfile
patch
OK, I vendored the module here: https://github.com/electron-userland/electron-json-storage/pull/187.
What is the patch you need on lockfile
? Are you trying to retry fs.statSync
? Given that you can reproduce the problem, if you have a patch you can confirm works for you, I'll happily apply it and release a new version :)
During concurrent read it crashes on lockfile library. It seems that the lockfile lib that this lib reference has a bug
https://github.com/npm/lockfile/blob/6590779867ee9bdc5dbebddc962640759892bb91/lockfile.js#L286
Notice that this line
var st = fs.statSync(path)
When it tries to read the path, the lock file is already being deleted by another concurrent read. Thus this line will throw and there is no catch. As a result this line crash with the following exception: