Repository navigation
Studio video stream encode: a failed final flush falls back instead of hanging the render - #14413
Merged
Merged
Conversation
…f hanging the render
Member
Author
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. 🎉 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
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.
Follow-up to #14405. If the streaming encoder fails during its final flush (for example the disk fills up while libx264 drains its last frames), the render hangs for good.
What was broken
StreamEncode._encodetakes the stop marker off the queue, then flushes the encoder. Whenstream.encode()orcontainer.mux()raises during that flush, the exception handler drains the queue until it sees another stop marker._joinhas already put the only one and is blocked inthread.join(), so neither the fallback encode nor cancel cleanup can finish.The fix
_encoderecords that it already took the stop marker and only drains the queue when it has not._failedis still set, sotake()returns None and the clip is encoded the normal way.Tests
test_a_failed_final_flush_falls_back_without_hanging: a fake container whose flush raisesOSError(28). On maintake()never returns (the test fails on its 60 s join); with the fix it returns None andclose()removes the temp file.tests/test_video_stream_encode.py: 10 passed.Found by an outside review of #14405, which reproduced the hang with the production
_encode/_joinand an encoder that fails only on flush.