Skip to content

race condition with stale locks? #121

@floitsch

Description

@floitsch

I'm just browsing the code, but isn't there a race condition when two processes encounter a stale lock at the same time?

Say p1 detects a stale lock and calls removeLock, but before it enters the function, is interrupted by the system.
In the meantime p2 detects the same stale lock and calls removeLock and succeeds. The same process, p2, then proceeds to acquireLock, creating a fresh directory. Now p1 receives CPU time and calls options.fs.rmdir, which was just created by p2 and calls acquireLock itself.
Both, p1 and p2, now believe that they successfully created the lock directory and proceed in parallel.

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