gopkg icon indicating copy to clipboard operation
gopkg copied to clipboard

fix: close consume chan when close in throttle waiting

Open joway opened this issue 6 months ago • 0 comments

Reproduction condition

  1. channel using consume throttle: eg ch := channel.New(channel.WithRateThrottle(0, 1))
  2. have a goroutine block on ch.Output()
  3. and then call ch.Close() in another goroutine

In such case, ch.Output() will not be triggered and this goroutine will be leak and block forever.

Reason

The root cause is when consume throttle recover, it forget to close channel and let output channel alive.

joway avatar Sep 03 '24 06:09 joway