Commit b74d8d37 authored by Ajit Jagtap's avatar Ajit Jagtap
Browse files

Merge branch 'ab_Fix_StatemdlBreaking' into 'devbranch'

Fix: Panic due to concurrent map r/w

See merge request !213
parents 24e11692 8f90663b
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() { ...@@ -392,6 +392,12 @@ func collectStatistics() {
clientResponseData.ServicesState = stateCache clientResponseData.ServicesState = stateCache
clientResponseData.QueryState = queryCache 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) ba, marshalError := ffjson.Marshal(clientResponseData)
if errormdl.CheckErr(marshalError) != nil { if errormdl.CheckErr(marshalError) != nil {
loggermdl.LogError(marshalError) 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