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

Guard against double channel close #35

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

Conversation

onitake
Copy link
Owner

@onitake onitake commented Jan 18, 2022

Fixes: #34

Closure of the output queue channel is guarded against by adding an atomic flag around it.
To make the code more readable and slightly less error-prone, the output queue is now fully abstracted, and its internal state can no longer be accessed directly.

Note that this does not prevent a potential race condition: If writing into the queue concurrently with a close(), the runtime may panic. It's vital that Close() is never executed while a write may be in progress. The PR addresses that by removing the connection from the pool directly after close (when entering inhibit) and by waiting for completion of the remove from pool command when the outgoing connection is closed.

@onitake onitake added this to the 0.8.2 milestone Jan 18, 2022
@onitake onitake modified the milestones: 0.8.2, 0.10.0 Oct 31, 2022
@onitake onitake changed the base branch from master to main June 28, 2023 17:24
@onitake onitake removed this from the 0.10.0 milestone Jun 28, 2023
@srgoni srgoni force-pushed the refactor-stream-close branch from 691947c to 7e80c72 Compare April 5, 2024 15:07
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.

Restreamer panics on "close of closed channel"
2 participants