mirror of
https://github.com/kubernetes/node-problem-detector.git
synced 2026-05-07 01:37:06 +00:00
fix(logwatchers/kmsg): don't close parser from Stop()
Closing the parser in Stop() triggers kmsgparser's read goroutine to close its output channel, which made watchLoop take the restart path (added in #1192) during intentional shutdown. Leave parser cleanup to watchLoop's defer, which is the single owner of the parser lifecycle.
This commit is contained in:
@@ -80,11 +80,8 @@ func (k *kernelLogWatcher) Watch() (<-chan *logtypes.Log, error) {
|
||||
return k.logCh, nil
|
||||
}
|
||||
|
||||
// Stop closes the kmsgparser
|
||||
// Stop signals the watch loop to stop.
|
||||
func (k *kernelLogWatcher) Stop() {
|
||||
if err := k.kmsgParser.Close(); err != nil {
|
||||
klog.Errorf("Failed to close kmsg parser: %v", err)
|
||||
}
|
||||
k.tomb.Stop()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user