Skip to content

Commit

Permalink
Fix bug in handling of state mutex in activity snapshots
Browse files Browse the repository at this point in the history
This may have been the cause of "unlock of unlocked mutex" errors
when having multiple servers configured.
  • Loading branch information
lfittl committed May 18, 2020
1 parent 7183566 commit 9c52d84
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions runner/activity.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,18 +94,18 @@ func CollectActivityFromAllServers(servers []state.Server, globalCollectionOpts
prefixedLogger.PrintInfo("Testing activity snapshots...")
}

servers[idx].StateMutex.Lock()
server.StateMutex.Lock()
newState, success, err := processActivityForServer(*server, globalCollectionOpts, prefixedLogger)
if err != nil {
servers[idx].StateMutex.Unlock()
server.StateMutex.Unlock()
allSuccessful = false
prefixedLogger.PrintError("Could not collect activity for server: %s", err)
if server.Config.ErrorCallback != "" {
go runCompletionCallback("error", server.Config.ErrorCallback, server.Config.SectionName, "activity", err, prefixedLogger)
}
} else {
servers[idx].PrevState = newState
servers[idx].StateMutex.Unlock()
server.PrevState = newState
server.StateMutex.Unlock()
if success && server.Config.SuccessCallback != "" {
go runCompletionCallback("success", server.Config.SuccessCallback, server.Config.SectionName, "activity", nil, prefixedLogger)
}
Expand Down

0 comments on commit 9c52d84

Please sign in to comment.