Skip to content

Commit 78f76b2

Browse files
committed
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.
1 parent 6411bde commit 78f76b2

1 file changed

Lines changed: 1 addition & 4 deletions

File tree

pkg/systemlogmonitor/logwatchers/kmsg/log_watcher_linux.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,8 @@ func (k *kernelLogWatcher) Watch() (<-chan *logtypes.Log, error) {
8080
return k.logCh, nil
8181
}
8282

83-
// Stop closes the kmsgparser
83+
// Stop signals the watch loop to stop.
8484
func (k *kernelLogWatcher) Stop() {
85-
if err := k.kmsgParser.Close(); err != nil {
86-
klog.Errorf("Failed to close kmsg parser: %v", err)
87-
}
8885
k.tomb.Stop()
8986
}
9087

0 commit comments

Comments
 (0)