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

fix(servstate): don't hold both servicesLock and state lock at once #359

Merged
merged 2 commits into from
Feb 15, 2024

Commits on Feb 13, 2024

  1. fix(servstate): don't hold both servicesLock and state lock at once

    This avoids the 3-lock deadlock described in
    canonical#314. Other goroutines may be
    holding the state lock and waiting for the services lock, so it's
    problematic to acquire both locks at once. Break that part of the
    cycle.
    
    We could do this inside serviceForStart/serviceForStop by manually
    calling Unlock() sooner, but that's error-prone, so continue using
    defer, but have the caller write the task log (which needs the state
    lock) after the services lock is released.
    benhoyt committed Feb 13, 2024
    Configuration menu
    Copy the full SHA
    5835c58 View commit details
    Browse the repository at this point in the history

Commits on Feb 15, 2024

  1. Add regression test for the deadlock issue

    This test consistently FAILs without the fix in this PR, but
    consistently PASSes with the fix in this PR. The repro is basically
    as per the instructions at
    canonical#314 (comment)
    benhoyt committed Feb 15, 2024
    Configuration menu
    Copy the full SHA
    2f0af96 View commit details
    Browse the repository at this point in the history