Closed Bug 1156891 Opened 6 years ago Closed 6 years ago
TSan: data race libstagefright/stubs/include/cutils/atomic
.h:23 stagefright::android _atomic _inc(int volatile*)
The attached logfile shows a thread/data race detected by TSan (ThreadSanitizer). * Specific information about this bug The implementation of the stagefright::android_atomic_* functions is completely bogus, substituting operations on |volatile T*| for real atomic operations. At least the source code owns up to this: http://mxr.mozilla.org/mozilla-central/source/media/libstagefright/stubs/include/cutils/atomic.h#9 It looks like we import this from upstream? Is there a good way to convince them to fix this? * General information about TSan, data races, etc. Typically, races reported by TSan are not false positives, but it is possible that the race is benign. Even in this case though, we should try to come up with a fix unless this would cause unacceptable performance issues. Also note that seemingly benign races can possibly be harmful (also depending on the compiler and the architecture) . If the bug cannot be fixed, then this bug should be used to either make a compile-time annotation for blacklisting or add an entry to the runtime blacklist.  http://software.intel.com/en-us/blogs/2013/01/06/benign-data-races-what-could-possibly-go-wrong  _How to miscompile programs with "benign" data races_: https://www.usenix.org/legacy/events/hotpar11/tech/final_files/Boehm.pdf
I can't think of a case where libstagefright would be used from two concurrent threads at once. We only use stagefright to read the metadata and this is always done on the media task queue
ThreadSanitizer is a dynamic analysis, so this is in fact happening in some test case. It looks like the writes are happening in threads named "Media P~back #4" and "Media P~back #3".
Could have just removed all that code alltogether as we don't care about the creation date anyway.
Attachment #8596989 - Flags: review?(ajones)
Assignee: nobody → jyavenard
Status: NEW → ASSIGNED
6 years ago
Attachment #8596989 - Flags: review?(ajones) → review+
You need to log in before you can comment on or make changes to this bug.