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 data race between Agent.Run() and Agent.Stop() #1625

Merged
merged 2 commits into from
Jun 26, 2019
Merged

Fix data race between Agent.Run() and Agent.Stop() #1625

merged 2 commits into from
Jun 26, 2019

Commits on Jun 21, 2019

  1. Fix data race between Agent.Run() and Agent.Stop()

    We had a data race with Agent.Stop() failing if called immediately
    after Agent.Run() returns.
    
    The root cause of the race was that Stop() called WaitGroup.Wait()
    before Run() called WaitGroup.Add() for the first time which is
    prohibited: https://golang.org/pkg/sync/#WaitGroup.Add
    
    This change moves WaitGroup.Add() to earlier stage which guarantees
    that WaitGroup.Wait() will be called after that.
    
    Github issue: #1624
    
    Testing done:
    
    Added automated tests which was failing before the bug was fixed
    and does not fail any more after the fix.
    
    Also verified that `make test` passes.
    
    Signed-off-by: Tigran Najaryan <[email protected]>
    tigrannajaryan committed Jun 21, 2019
    Configuration menu
    Copy the full SHA
    3741f27 View commit details
    Browse the repository at this point in the history

Commits on Jun 25, 2019

  1. Fix based on PR comments

    Signed-off-by: Tigran Najaryan <[email protected]>
    tigrannajaryan committed Jun 25, 2019
    Configuration menu
    Copy the full SHA
    b1894be View commit details
    Browse the repository at this point in the history