The clang ThreadSanitizer reports a data race in the following code:
#include
#include
#include
int main() {
std::cout << "start!" << std::endl;
for (size_t i = 0; i < 100000; i++) {
std::promise…
I am using Clang-8 with thread sanitizer enabled to compile the code below
std::atomic ptr {nullptr};
int data {0};
void producer() {
std::string* p = new std::string("Hello");
data = 42;
ptr.store(p,…
With Swift 3.1 on XCode 8.3, running the following code with the Thread Sanitizer finds a data race (see the write and read comments in the code):
private func incrementAsync() {
let item = DispatchWorkItem { [weak self] in
guard let…
I am experiencing some issues with thread sanitizer (TSan) complaining about a data race in some production code where std::packaged_task are handed over to a dispatcher thread by wrapping them in a std::function. For this question I have simplified…
Is there a difference between ThreadSanitizer suppression files and blacklist files? -- when used by the llvm-specific compiler flag of -fsanitize-blacklist=
When should I use one over the other?
Note: Crossposted
I am trying to use gcc's thread sanitizer (-fsanitize=thread) to check for data races in my application. Unfortunately, the output is flooded with what I think are false positives caused by the implementation of the extended…
I have some code in my project in inline assembly, does TSAN instrument it?
let's look at this example:
T0: x++
T1: (inline assembly code) MOV x, 2;
will we get data race here(assuming no sync at all)? if so, does it instrument all assembly memory…
I'm trying to write a small testcase to exercise std::shared_timed_mutex::try_lock_until. Documentation on cppreference.
Here is my code
#include
#include
#include
#include
#include
…
I am running a program with thread sanitizers and wonder how to interpret the following warning:
==================
WARNING: ThreadSanitizer: data race (pid=2788668)
Read of size 4 at 0x7f7eefc4e298 by main thread:
[Stacktrace follows...]
…
I made a custom property wrapper which provides a method to access data in a mutually exclusive context using an os_unfair_lock. After testing my wrapper with TSAN enabled, an access race error was reported at the point of lock acquisition using…
I am testing some code using Google's tsan thread sanitizer. Tsan is telling me that I have a race condition in a particular function, but it is not clear to me from looking at the output what the problem is. Is it possible to set a breakpoint in…
building QEMU with TSAN did not get any problem
but it get FATAL during start up
ThreadSanitizer: can't find longjmp buf
FATAL: ThreadSanitizer CHECK failed: ../../../../src/libsanitizer/tsan/tsan_interceptors.cc:544 "((0)) != (0)" (0x0, 0x0)
#0…
I have following code:
std::thread thread;
EventReceiver target;
{
thread = std::thread([&]() {
auto event = new MyEvent();
QCoreApplication::postEvent(&target, event);
}
});
IdleProcessor::processEvents();
…
When I create a new Single View App from in Xcode Version 11.3 (11C29) and run it all is ok.
When I turn on Thread Sanitize
And try to run the very same app, I get Thread 1: signal SIGABRT
this is the backtrace
(lldb) bt
* thread #1, stop reason…
With Xcode 11.2.1 created a single View project for iOS and enabled the Thread Sanitizer in Scheme. Note: Running the app on Simulator iPhone Xr 13.2.2
Once run the project, getting below error:
The request was denied by service delegate…