Skip to content

Commit

Permalink
Merge pull request juju#18009 from manadart/3.4-fix-controller-race
Browse files Browse the repository at this point in the history
juju#18009

This fixes a race added under juju#17816. It was detected in CI by the race suite.

We already had lock protection around the write site (`Refresh`), but we added a new read of `Status` without such protection. This adds it.

## QA steps

```
TEST_PACKAGES="./worker/peergrouper -count=100 -timeout=10m -race" TEST_FILTER="Suite" GOTRACEBACK=all make run-go-tests
```
should do it.

## Documentation changes

None

## Links

**Jira card:** [JUJU-6598](https://warthogs.atlassian.net/browse/JUJU-6598)



[JUJU-6598]: https://warthogs.atlassian.net/browse/JUJU-6598?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
  • Loading branch information
jujubot authored Sep 3, 2024
2 parents 5717831 + 59cc8b5 commit 44225ac
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions worker/peergrouper/controllertracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,9 @@ func (c *controllerTracker) hasNodeChanged() (bool, error) {
}

func (c *controllerTracker) hostPendingProvisioning() (bool, error) {
c.mu.Lock()
defer c.mu.Unlock()

status, err := c.host.Status()
if err != nil {
return false, errors.Trace(err)
Expand Down

0 comments on commit 44225ac

Please sign in to comment.