Xcode 11.4 triggers “ThreadSanitizer CHECK failed” but doesn’t hit breakpoints

In my current iOS project, if I run with Xcode’s thread sanitizer enabled, sometimes I’ll get this in the console output and the app will halt:


FATAL: ThreadSanitizer CHECK failed: /BuildRoot/Library/Caches/com.apple.xbs/Sources/clang_compiler_rt/clang-1103.0.32.29/compiler-rt/lib/sanitizer_common/sanitizer_allocator.cc:166 "((kBlockMagic)) == ((((u64*)addr)[0]))" (0x6a6cb03abcebc041, 0x0)


This doesn’t hit the Thread Sanitizer runtime breakpoint, the “All Runtime Issues” breakpoint, the “All Exceptions” breakpoint, or the “Swift Error” breakpoint. My only fix so far has been to recompile with the Thread Sanitizer disabled. Anyone else seeing this?

I'm also seeing this in a unit test https://github.com/willowtreeapps/PinkyPromise/blob/4c78d842fafc267ce06de3e77b2c01afef5cfbb9/Tests/PinkyPromiseTests/PromiseTest.swift#L846


FATAL: ThreadSanitizer CHECK failed: /BuildRoot/Library/Caches/com.apple.xbs/Sources/clang_compiler_rt/clang-1103.0.32.26/compiler-rt/lib/sanitizer_common/sanitizer_allocator.cc:166 "((kBlockMagic)) == ((((u64*)addr)[0]))" (0x6a6cb03abcebc041, 0x7b5000004000)

It does seem that fixing the threading issue within the code being tested does prevent this check from failing.

It does seem that fixing the threading issue within the code being tested does prevent this check from failing.

Cool. Any chance you can distill the threading issue into a small test project? If so, we’d appreciate you attaching it to a bug report against TSan.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

We would definitely appreciate a bug report against TSan.


A possible workaround is to add an environment variable 'TSAN_OPTIONS' with the value 'symbolize=0'. You can this by going to the Scheme Editor, selecting the 'Run' action, choosing the 'Arguments' tab, and adding an environment variable with that name and option.

This happened to me as well.


I had an issue in a constraint defined via code. I had written `multiplier: 0, constant: 1` instead of `multiplier: 1, constant: 0`.


I noticed the error when I disabled TSan and got the error in the console.


Once the error was fixed, I re-enabled TSan and everything worked fine.

Just an fyi, it seems like the crash has been fixed in Xcode 11.5, but now the stack doesn't symbolize in the console dump


You can still use `bt all` in the console to get a dump of threads or set the Thread Sanitizer breakpoint if needed


now the stack doesn't symbolize in the console dump

Just to clarify, that limitation is documented in the Xcode 11.5 Release Notes (search for 61840387).

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"
Xcode 11.4 triggers “ThreadSanitizer CHECK failed” but doesn’t hit breakpoints
 
 
Q