fix(inputs.tail): Prevent deadlock when closing and max undelivered lines hit (#15649)
This commit is contained in:
parent
5cb142e676
commit
6874f41739
|
|
@ -370,6 +370,11 @@ func (t *Tail) receiver(parser telegraf.Parser, tailer *tail.Tail) {
|
|||
select {
|
||||
case <-t.ctx.Done():
|
||||
return
|
||||
// Tail is trying to close so drain the sem to allow the receiver
|
||||
// to exit. This condition is hit when the tailer may have hit the
|
||||
// maximum undelivered lines and is trying to close.
|
||||
case <-tailer.Dying():
|
||||
<-t.sem
|
||||
case t.sem <- empty{}:
|
||||
t.acc.AddTrackingMetricGroup(metrics)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue