Questions tagged [thread-sanitizer]
ThreadSanitizer (TSan) is a data race detector for C/C++ programs.
thread-sanitizer
110
questions
0
votes
0
answers
62
views
tsan thread sanitizer, why only a single bug is reported
I wrote a simple test prog which contains two data races. But tsan only reports the first one what ever I try to modify.
Is tsan always only reporting a single bug? Maybe tsan can't see some bugs ...
0
votes
0
answers
19
views
gdb and thread sanitizer gcc, how to stop on warning/error
I tried to run a program compiled with thread sanitizer under gdb control. I simply want to stop if an warning/error occurs.
From How to add breakpoint when thread sanitizer reports data-race? I found
...
2
votes
0
answers
131
views
FATAL: ThreadSanitizer: unexpected memory mapping GCC 13.2
I've already seen FATAL: ThreadSanitizer: unexpected memory mapping when running on Linux Kernels 6.6+ (for clang) and Thread sanitizer complaining of unexpected memory map (with an answer saying not ...
4
votes
0
answers
78
views
Why the compiler still complains even if std::mutex has been used when `-fsanitize=thread -ltsan` are enabled?
Why the compiler complain about this code snippet when -std=c++11 -lpthread -fsanitize=thread -ltsan are enabled?
#include <iostream>
#include <memory>
#include <thread>
#include <...
1
vote
1
answer
54
views
Force ThreadSanitizer to crash after finding a problem
I'm running ThreadSanitizer with -02 and g compiler flags and without gdb. It detects the race condition and prints the stacktraces but it continues running. I was fortunate to be monitoring.
Is there ...
3
votes
0
answers
50
views
False positive thread sanitizer [duplicate]
I wrote the following code example
#include <thread>
#include <condition_variable>
#include <mutex>
int main()
{
std::mutex mutex;
bool done = false;
std::...
3
votes
0
answers
82
views
Is it allowed to use thread and undefined sanitizers at the same time?
I'm using the -fsanitize=thread,undefined option in my project. When running the thread, the sanitizer indicates a race.
// Compiled on g++ 11.4 with the command g++ ./main.cc -fsanitize=undefined,...
0
votes
0
answers
21
views
TSAN: Reporting intermittent data race
I have been using TSAN build for detecting thread data races in my project and it works pretty well in most of the cases. At times, I understand TSAN could potentially report false positives, harmless ...
0
votes
0
answers
17
views
ThreadSanitizer reports data race on this code
This code is simulating interrupts in hardware. There are 2 threads. The main thread constructs a Hardware object and waits for Ctrl+C. The server thread handles web requests and calls the interrupt ...
0
votes
0
answers
50
views
Can llvm-archer support g++ Tsan to understand Openmp? and How to do it?
According to Can I use Thread Sanitizer for OpenMP programs?, I konw Tsan doesn't support well for Openmp and I have resolved this issue according to the official documentation https://github.com/llvm/...
1
vote
0
answers
237
views
TSAN data-race reported when two classes refer to each other via weak_ptr
I'm using clang++ with LLVM17. I have two classes Foo and Bar that both refer to each other via a weak_ptr data member. There are multiple threads that can get copies of shared_ptr<Bar> objects. ...
3
votes
0
answers
465
views
(TSAN) /usr/bin/ld can't find libtsan_preinit.o
Notice: This issue has been resolved, but I don't see it in the stackoverflow, so I brought it up for others to refer to.
My execution environment is gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0. When I ...
17
votes
1
answer
4k
views
FATAL: ThreadSanitizer: unexpected memory mapping when running on Linux Kernels 6.6+
The Problem
Recently on Linux Kernels 6.6.6 and higher it was discovered that thread sanitizer will always lead to this error:
FATAL: ThreadSanitizer: unexpected memory mapping 0x5c9bd4d2b000-...
0
votes
1
answer
208
views
Why do Valgrind-based Helgrind thread error detector and Google ThreadSanitizer (TSan) report different data race detection results?
1.Background
① The C++ code in Listing 1 below aims at handling data race for the s variable that the Produce function (running on the main thread) and Consume function (running on the t thread ...
0
votes
1
answer
63
views
TSan doesn't sybmolize dynamically linked SO
I've got the following problem with TSAN (g++ 9.4.0) on Ubuntu 20.04.2 - it doesn't symbolize symbols from dynamically loaded SOs (while does for the executed binary itself):
WARNING: ThreadSanitizer: ...