Commit 8f90663b authored by Akshay Bharambe's avatar Akshay Bharambe
Browse files

Fix: Panic due to concurrent map r/w

parent 24e11692
Branches
Tags
2 merge requests!214Release v1.1.1,!213Fix: Panic due to concurrent map r/w
Showing with 6 additions and 0 deletions
......@@ -392,6 +392,12 @@ func collectStatistics() {
clientResponseData.ServicesState = stateCache
clientResponseData.QueryState = queryCache
// the marshall function reads data from clientResponseData.ServicesState and clientResponseData.QueryState
// as both are maps, we have passed a referrence of stateCache and queryCache respectively.
// The following lock guards these two underlying data structures.
stateMutex.Lock()
defer stateMutex.Unlock()
ba, marshalError := ffjson.Marshal(clientResponseData)
if errormdl.CheckErr(marshalError) != nil {
loggermdl.LogError(marshalError)
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment