Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: close consume chan when close in throttle waiting #230

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

joway
Copy link
Collaborator

@joway joway commented Sep 3, 2024

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 joway enabled auto-merge (squash) September 3, 2024 06:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants