Skip to content

Commit 705cb01

Browse files
authored
Merge pull request #339 from wenjun93/logmonitor
avoid log channel closed caused endless loop
2 parents bac3429 + 4a4ebc7 commit 705cb01

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pkg/systemlogmonitor/log_monitor.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,11 @@ func (l *logMonitor) monitorLoop() {
129129
l.initializeStatus()
130130
for {
131131
select {
132-
case log := <-l.logCh:
132+
case log, ok := <-l.logCh:
133+
if !ok {
134+
glog.Errorf("Log channel closed")
135+
return
136+
}
133137
l.parseLog(log)
134138
case <-l.tomb.Stopping():
135139
l.watcher.Stop()

0 commit comments

Comments
 (0)