mirror of
https://github.com/go-ping/ping.git
synced 2026-02-21 07:32:26 +00:00
Deadlock fix (#85)
Deadlock observed when starting multiple ping routines.
It happens when writting to `recv` channel (which is full) and no active
readers for this channel.
*Example to reproduce the issue* :
var waiter sync.WaitGroup
pingFunc := func() {
defer waiter.Done()
pinger, err := ping.NewPinger("8.8.8.8")
if err != nil {
return
}
pinger.SetPrivileged(true)
pinger.Count = 5
pinger.Interval = time.Second
pinger.Timeout = time.Second * 4
pinger.Run()
}
for i := 0; i < 1000; i++ {
waiter.Add(1)
go pingFunc()
}
waiter.Wait() // deadlock here! (reproducible almost every time)
This commit is contained in:
committed by
GitHub
parent
e8ae07c3ce
commit
70ede2ab32
Reference in New Issue
Block a user