Skip to content

fix(previews): ffprobe hangs#60916

Open
adduxa wants to merge 1 commit into
nextcloud:masterfrom
adduxa:fix/previews/ffprobe-hangs
Open

fix(previews): ffprobe hangs#60916
adduxa wants to merge 1 commit into
nextcloud:masterfrom
adduxa:fix/previews/ffprobe-hangs

Conversation

@adduxa
Copy link
Copy Markdown
Contributor

@adduxa adduxa commented Jun 1, 2026

Summary

Fix pipe buffer deadlock in useHdr() in lib/private/Preview/Movie.php.

When ffprobe produces more than ~64KB on stderr, the sequential stream_get_contents calls
deadlock: PHP blocks reading stdout while ffprobe blocks flushing stderr. This caused
occ preview:generate-all to hang indefinitely on certain video files.

A tempting workaround is to swap the two stream_get_contents calls (reading stderr first),
but I'm not sure if ffprobe is guaranteed to produce <64KB on the stdout for this call.

Fix drains both pipes concurrently using stream_select with non-blocking I/O.

TODO

  • ...

Checklist

AI (if applicable)

  • The content of this PR was partly or fully generated using AI

Signed-off-by: Andrey Dyakov <adduxa@gmail.com>
@adduxa adduxa requested a review from a team as a code owner June 1, 2026 21:27
@adduxa adduxa requested review from ArtificialOwl, artonge, icewind1991 and leftybournes and removed request for a team June 1, 2026 21:27
@susnux susnux added bug 3. to review Waiting for reviews labels Jun 1, 2026
@susnux susnux added this to the Nextcloud 35 milestone Jun 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: preview:generate-all hangs indefinitely on a specific .MTS video file waiting for ffprobe

2 participants