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

Message port close events channel after all the sender routines exited #6

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

magodo
Copy link

@magodo magodo commented Aug 31, 2023

When the context of the Listen() being canceled. There is a race condition that the goroutine that closes the events channel runs prior than the other handler goroutines (for both message/messageerror). If this happens, those handler goroutines will panic as the events channel is closed, and sending to a closed channel just panics in Go.

magodo added 2 commits August 31, 2023 21:43
When the context of the `Listen()` being canceled. There is a race condition that the goroutine that closes the `events` channel runs prior than the other handler goroutines (for both `message`/`messageerror`). If this happens, those handler goroutines will panic as the `events` channel is closed, and sending to a closed channel just panics in Go.
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.

1 participant