From xiujunwang.dev at gmail.com Sat Oct 24 05:08:28 2026 From: xiujunwang.dev at gmail.com (xiujunwang.dev at gmail.com) Date: Fri, 23 Oct 2026 22:08:28 -0700 Subject: [x264-devel] [PATCH v2 0/2] Fix input-frame recycling and threadpool shutdown races In-Reply-To: References: Message-ID: Hi, Following up on this two-patch series from September 25. Both races were reproduced with ThreadSanitizer on macOS arm64, with validation results included in the cover letter. Could someone take a look, or suggest an appropriate reviewer? Happy to provide additional reproducer details or tests if helpful. Thanks, Xiujun On Fri, 25 Sep 2026 23:41:27 +0800, ??? wrote: > Hello, > > The v1 patch message bodies were damaged by Gmail's flowed-text > formatting, which collapsed some indentation. Please use this v2 > series. The patch content is unchanged; the two raw patch files are > attached to their respective messages. > > This series fixes two races reproduced on x264 master 0480cb05. > > Patch 1 serializes input-frame release and unused-list push/pop with a > shared mutex. The lookahead thread can release last_nonb concurrently > with the caller releasing fenc or obtaining another input frame. > > Patch 2 moves the threadpool exit check under its existing run mutex. > This independent race was exposed by closing without flushing. > > Validation on macOS arm64, Apple clang 21.0.0: > - Unmodified master reproduces both races under ThreadSanitizer. > - Six 1,200-frame TSan runs pass without suppressions. > - A 128x288, four-slice-thread TSan run passes for 240 frames. > - Closing without flushing after each input count 0..40 passes under TSan. > - Native-assembly checkasm8 and checkasm10 pass. > - Six release-mode comparisons have identical non-SEI NAL data and > decoded frame MD5s. > - A --disable-thread build and a 200-frame encode pass. > > These tests cover the configurations above; OpenCL and other platforms > were not tested. > > Best regards, > Xiujun Wang