Skip to content

Racing issue on concurrent read #186

Open
@davidliudev

Description

@davidliudev

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:

There is error loading the config  somefilename , err= Error: ENOENT: no such file or directory, stat 'somefilename.json.lock'
    at statSync (VM40 node:fs:1538:3)
    at e.statSync (VM116 asar_bundle:5:4539)
    at exports.lockSync (lockfile.js:286:1)
    at exports.lockSync (lock.js:84:1)
    at exports.getSync (storage.js:240:1)
    at exports.getSync (storage.js:243:1)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions