Repository navigation
fix: o!rdr render poll deadlocks on finished renders - #1138
Merged
Merged
Conversation
poll_finished_renders acquires a read lock on the render's shard and only drops it at the end of the loop body, but then calls senders.own(render_id) for the unsubscribe - a write lock on the same shard while still holding the read lock. This self-deadlocks the poll task as soon as it finds a finished render with a live subscriber. The frozen read guard then wedges all future subscribers of that shard, whose queued write locks in turn block the event loop's reads, freezing it outside of its select! - so the watchdog can never fire and no further websocket events are dispatched. - drop the read guard before any await by cloning the senders out first - same treatment in the websocket event loop so a slow subscriber can't stall the loop while holding a shard lock - progress updates now use try_send; they are cosmetic so drop them on a full channel instead of blocking - log the poll's previously silent error paths
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
poll_finished_rendersacquires a read lock on the render's shard and only drops it at the end of the loop body, but then callssenders.own(render_id)for the unsubscribe — a write lock on the same shard while still holding the read lock. This self-deadlocks the poll task as soon as it finds a finished render with a live subscriber (~5 minutes after boot).The frozen read guard then wedges all future subscribers of that shard, whose queued write locks in turn block the websocket event loop's reads (tokio's RwLock is fair), freezing it outside of its
select!— so the watchdog can never fire and no further websocket events are dispatched. Symptoms:Subscribinggets logged but no events ever follow, and no warnings appear.try_send; they're cosmetic so drop them on a full channel instead of blocking