[FFmpeg-devel] Tracking down frame corrupting race conditions on Windows.
Michael Niedermayer
michaelni at gmx.at
Sat Apr 21 01:55:05 CEST 2012
On Fri, Apr 20, 2012 at 01:49:13PM -0700, Dale Curtis wrote:
> All,
>
> We've been running into an issue where the decoder (avcodec_decode_video2) is
> returning corrupted frames on Win32; some images showing the corruption:
>
> http://code.google.com/p/chromium/issues/detail?id=120396#c13
>
> The problem is most easily detected when run under thread sanitizer (TSAN)* with
> a hash test. I've created a sample program which simply decodes and hashes
> each frame (using the av_sha_* interfaces) to illustrate this:
>
> Without TSAN and 2 threads:
> > hash-test.exe bear0.mp4 2
> 000: a1d99a1a3f6ec3ffbad916ad34e14a69b011ece10505930fea07f5a5cd988a7c
> <...>
> 081: d857354e53a1161e1be083e95e01ad7a12920c5307c37d012c8fa1d3fb784fc2
> 36be212f0080fe4e74a2187cad8f393fafecf5760f3e88e273fc59d683582ddf
>
> With TSAN and 2 threads:
> > tsan\tsan.bat --log-file=tsan.txt -- hash-test.exe bear0.mp4 2
> 000: e5a0e89c28c8ade300ae572508aeab2f06b59e0da30a20abde926da4003dc680
> <...>
> 081: 85582db265d1f2ec90d32f5642075af81397c0de2d606defb3d704eeca261253
> 1c746db9b787908287662a302f74de852a682fcb3539abbc204a41671ae66161
>
> With TSAN and 1 threads:
> > tsan\tsan.bat --log-file=tsan.txt -- hash-test.exe bear0.mp4 1
> 000: a1d99a1a3f6ec3ffbad916ad34e14a69b011ece10505930fea07f5a5cd988a7c
> <...>
> 081: d857354e53a1161e1be083e95e01ad7a12920c5307c37d012c8fa1d3fb784fc2
> 36be212f0080fe4e74a2187cad8f393fafecf5760f3e88e273fc59d683582ddf
>
> Our assumption is that the output from threads == 1 should be indistinguishable
> from output with threads > 1. Some general notes:
>
> - The issue occurs with at least h264, vp8, and theora files.
> - We have seen no issues under Linux or Mac, which is not to say there are no
> problems. The Windows version of TSAN runs much slower than the Linux
> or Mac variants and thus may be more susceptible to the issue.
> - Switching to pthreads instead of using w32threads on Windows does not fix
> the problem.
> - Given the hash changes with the number of threads, we suspect the problem
> is a race condition.
> - It's possible TSAN is breaking something fundamental, however past
> experience with the tool has shown the worst case to be false positives;
> never spurious impacts to the running program...
> - FATE will fail its hash tests on almost every single test if TSAN is set as
> the target_exec on Windows.
>
> To reproduce the results, the fastest way is to grab the test bundle from here:
>
> http://commondatastorage.googleapis.com/dalecurtis-shared/hash-test.zip
I tried the video files under linux with and without tsan i tried it
under wine without tsan, all match
wine + tsan gives me
fixme:ntdll:FILE_CreateFile alloc_size not supported
so i dunno, is it possible to run windows tsan under wine ?
[...]
> acolwell and I have spent a lot of time trying to track down the source of this
> corruption on Windows without much success. We're hoping the community might
> have some better ideas on where to look. Thanks in advance for any assistance!
have you tried without asm (inline+yasm) ? (thats just a random idea,
unlikely to help)
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
In fact, the RIAA has been known to suggest that students drop out
of college or go to community college in order to be able to afford
settlements. -- The RIAA
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120421/d25dae4c/attachment.asc>
More information about the ffmpeg-devel
mailing list