Skip to content

[apple_hevc] v0.0.2: fix file-test crash on failed probe + mimetypes thread race - #514

Merged
Josh5 merged 1 commit into
Unmanic:officialfrom
funkekaiser:pr-apple_hevc
Aug 14, 2026
Merged

[apple_hevc] v0.0.2: fix file-test crash on failed probe + mimetypes thread race#514
Josh5 merged 1 commit into
Unmanic:officialfrom
funkekaiser:pr-apple_hevc

Conversation

@funkekaiser

Copy link
Copy Markdown

Problem

The vendored apple_hevc here is v0.0.1, whose library-management file test crashes whenever the file probe fails: Probe.init_probe() returns None on a failed probe and the plugin dereferences it (AttributeError: 'NoneType' object has no attribute 'file'). Each crash aborts the entire file-test chain for that file, so subsequent plugins never run on it either.

The probes fail more than you'd expect, because of a thread race in the vendored ffmpeg helper lib: Probe.__init__ calls mimetypes.init() on every instantiation, rebuilding Python's global mimetype database — and Unmanic runs file tests on several concurrent tester threads, so other threads' guess_type() calls race the rebuild and get None for valid mp4 files. Observed on a live library: 168 crashes in a single scan; ~160 hev1 mp4s silently never queued for their hvc1 remux, clustered by directory (thread timing).

Fix

Testing: verified against Unmanic 0.4.0+e838573 (josh5/unmanic:latest), 4 concurrent file testers + 3 QSV workers: all previously-skipped hev1 mp4s queue correctly and remux to hvc1 (ffprobe-verified). No new python files introduced.

🤖 Generated with Claude Code

Fix the library-management file test crashing whenever the file probe
fails: Probe.init_probe() returns None on a failed probe and the plugin
dereferenced it (AttributeError: 'NoneType' object has no attribute
'file'). Each crash aborts the whole file-test chain for that file. This
mirrors the fix the plugin author committed to their development repo
(k29t59dh/unmanic-plugins@0e41183) which was never released here.

Also fix the underlying reason probes were failing at all: the vendored
ffmpeg helper lib calls mimetypes.init() on every Probe() instantiation,
rebuilding Python's global mimetype database. Under Unmanic's concurrent
file-tester threads this races guess_type() in other threads into
returning None for valid mp4 files, which silently skipped them during
scans (observed: 168 crashes in one scan; ~160 hev1 mp4s never queued).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@Josh5
Josh5 merged commit 74f312c into Unmanic:official Aug 14, 2026
2 checks passed
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.

2 participants