Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add process lock to avoid parallel cross issues. #963

Closed
wants to merge 1 commit into from

Commits on Jul 19, 2022

  1. Add process lock to avoid parallel cross issues.

    Docker can have deadlocks or similar issues when invoked multiple times
    in rapid succession, so this implements a small and correct process lock
    with an identical API to `named_lock`. This allows us to prevent
    invoking Docker multiple times.
    
    The implementation uses `flock` on Linux/UNIX-like systems, which on
    Linux is guaranteed to be cleaned up when the process exits. On Windows, it uses `CreateMutexW`, which also guarantees to be cleaned up when the process exits.
    
    We use this rather than `fd-lock` because `fd-lock` has more dependencies, and it also uses `LockFile` on Windows which is not guaranteed to be cleaned up in a timely manner. The API is also designed for file locks, not process locks, which is only a good abstraction on UNIX-like systems.
    
    We use this rather than `named_lock` since it has numerous, unnecessary dependencies. This allows us to have no external dependencies besides libc and the Windows API, for an extremely lightweight locking library.
    Alexhuszagh committed Jul 19, 2022
    Configuration menu
    Copy the full SHA
    a006076 View commit details
    Browse the repository at this point in the history