fix lock when dumping the parsing state in explain mode (#2234)

This commit is contained in:
blotus 2023-05-26 16:23:50 +02:00 committed by GitHub
parent f6924f8c57
commit 6720d89845
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -326,11 +326,11 @@ func Parse(ctx UnixParserCtx, xp types.Event, nodes []Node) (types.Event, error)
}
clog.Tracef("node (%s) ret : %v", node.rn, ret)
if ParseDump {
StageParseMutex.Lock()
if len(StageParseCache[stage][node.Name]) == 0 {
StageParseMutex.Lock()
StageParseCache[stage][node.Name] = make([]ParserResult, 0)
StageParseMutex.Unlock()
}
StageParseMutex.Unlock()
evtcopy := deepcopy.Copy(event)
parserInfo := ParserResult{Evt: evtcopy.(types.Event), Success: ret}
StageParseMutex.Lock()