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

Panic due to double channel close in Streamer.Stream() #45

Open
onitake opened this issue Jul 21, 2023 · 0 comments
Open

Panic due to double channel close in Streamer.Stream() #45

onitake opened this issue Jul 21, 2023 · 0 comments
Assignees
Labels

Comments

@onitake
Copy link
Owner

onitake commented Jul 21, 2023

In Streamer.Stream(), there is an inherent concurrency issue, because the Connection.Closed flag is used to determine if the Connection.Queue channel needs to be closed or not:

if !request.Connection.Closed {
close(request.Connection.Queue)
}

If someone closes the channel, the flag update is delayed, and a concurrent goroutine may try to close it again:

conn.Closed = true

As quick&dirty workaround, recover() can be used, but it would be better to remove this flag and find a different way to signal closure and trigger cleanup.

@onitake onitake added the bug label Jul 21, 2023
@onitake onitake self-assigned this Jul 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant