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

[25.0 backport] libcontainerd/supervisor: fix data race #47313

Merged

Commits on Feb 3, 2024

  1. libcontainerd/supervisor: fix data race

    The monitorDaemon() goroutine calls startContainerd() then blocks on
    <-daemonWaitCh to wait for it to exit. The startContainerd() function
    would (re)initialize the daemonWaitCh so a restarted containerd could be
    waited on. This implementation was race-free because startContainerd()
    would synchronously initialize the daemonWaitCh before returning. When
    the call to start the managed containerd process was moved into the
    waiter goroutine, the code to initialize the daemonWaitCh struct field
    was also moved into the goroutine. This introduced a race condition.
    
    Move the daemonWaitCh initialization to guarantee that it happens before
    the startContainerd() call returns.
    
    Signed-off-by: Cory Snider <csnider@mirantis.com>
    (cherry picked from commit dd20bf4)
    Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
    corhere authored and thaJeztah committed Feb 3, 2024
    Configuration menu
    Copy the full SHA
    c12bbf5 View commit details
    Browse the repository at this point in the history