Questions tagged [thread-sanitizer]

ThreadSanitizer (TSan) is a data race detector for C/C++ programs.

ThreadSanitizer (aka tsan, not "Thread Sanitizer") is a data race detector for C/C++ programs.

See also:

91 questions
1
vote
0 answers

TSan in GCC reports errors that Clang does not

I've implemented a locked hash table and I've created a unit test of the same to test concurrent read/writing to the table. After thread sanitisation with clang (AppleClang), it reports no errors but GCC (g++8) on the other hand spills lines of what…
SagunKho
  • 985
  • 10
  • 26
1
vote
1 answer

How can I link to thread sanitizer with a newer version of clang than the system provides?

I download normally the latest clang version from their website. This helps me use the latest version of C++ as doing this with gcc is not really possible. I just get the binaries for my Ubuntu/Debian and I'm good to go. For me, linking with tsan…
The Quantum Physicist
  • 24,987
  • 19
  • 103
  • 189
1
vote
1 answer

Shadow memory and fPie error when running code with thread sanitizer?

The following code sample is compiled with the subsequent command line input #include #include #include #include typedef std::map map_t; void *threadfunc(void *p) { map_t& m =…
coolDude78
  • 11
  • 2
1
vote
1 answer

A tool to detect misuses of the POSIX pthreads API but not Helgrind

For some reason I can't use Helgrind to detect misuses of the POSIX pthreads API (for example, unlocking a non-locked mutex, deallocation of memory that contains a locked mutex and so on). I tried to find another tool but actually failed. As I found…
WildWind03
  • 301
  • 3
  • 14
1
vote
1 answer

Thread sanitizer causes the app to freeze up constantly?

Whenever I start the app up with the thread sanitizer on, it just freezes up. When I pause execution, I always see some sort of tsan function call that the main thread has become completely stuck on. How can I prevent this? I'm using Xcode 8.3.2.
meisel
  • 2,151
  • 2
  • 21
  • 38
1
vote
1 answer

Synchronization via shared_ptr: ThreadSanitzier false positive?

The following code synchronizes via shared_ptr: #include #include #include #include #include #include using std::shared_ptr; using std::async; using std::launch; using…
Craig P
  • 63
  • 6
1
vote
1 answer

Data Race in Dispatch Timer Source

ThreadSanitizer detects a data race in the following Swift program run on macOS: import Dispatch class Foo { var value: T? let queue = DispatchQueue(label: "Foo syncQueue") init(){} func complete(value: T) { queue.sync…
CouchDeveloper
  • 18,174
  • 3
  • 45
  • 67
1
vote
0 answers

dmake: Error code 137, while making 'Shell escape' after using -Wl,-Ttext-segment=0x855555000000 and /proc/sys/kernel/randomize_va_space value is 2

I am getting following error message while running my thread-sanitized executable. (I have used -fPIC and -fsanitized=thread flag at compilation , -fsanitize=thread -Wland '-pie' flag during executable time): FATAL: ThreadSanitizer can not mmap the…
1
vote
1 answer

ThreadSanitizer (tsan) - Meaningful information from shared library

My app used the wxWidgets library, built from source via gcc 5.1.0, using -g and -O0 I compiled my app using clang++36 -g -fsanitize=thread -stdlib=libc++, and linked it using clang++36 -g -fsanitize=thread -stdlib=libc++ -lc++abi. It dynamically…
user1902689
  • 1,655
  • 2
  • 22
  • 33
0
votes
1 answer

Thread Sanitizer and Intel OpenMP

We are using GCC and Intel OpenMP. I know that the combination of GCC and GCC OpenMP needs a special build of OpenMP (to use pthread interfaces rather than directly use the futex system call). Is it possible to use Thread Sanitizer and GCC + Intel…
Paul Floyd
  • 5,530
  • 5
  • 29
  • 43
0
votes
0 answers

LLVM TSan and OpenMP explicit Tasks

I'm getting warnings about data races from Thread Sanitizer in this toy example: #include #include #include int main () { std::vector vec(10); // increase each vector entry 10 times. Each increment is one…
Seriously
  • 884
  • 1
  • 11
  • 25
0
votes
1 answer

Is Thread Sanitizer expected to be able to correctly analyze lock-free code?

Background motivation: I have some code that uses a lock-free algorithm to share audio data to/from a CoreAudio callback (only because CoreAudio callbacks-threads are real-time and therefore aren't allowed to lock mutexes). This code seems to work…
Jeremy Friesner
  • 70,199
  • 15
  • 131
  • 234
0
votes
0 answers

ThreadSanitizer data race when multiple threads write the same value

I have a program where many threads do some computations and write a boolean true value in a shared array to tag the corresponding item as "dirty". This is a data race, reported by ThreadSanitizer. Nevertheless, the flag is never read from these…
Julien
  • 2,139
  • 1
  • 19
  • 32
0
votes
2 answers

tbb's private_server and false positive ThreadSanitizer data races

We are getting false positive ThreadSanitizer (tsan) data race warnings on a frequent but inconsistent basis. Though it is well-known that tsan can give false positive warnings, some of which may be suppressed via the TSAN_OPTIONS environment…
Matt
  • 20,108
  • 1
  • 57
  • 70
0
votes
0 answers

ThreadSanitizer data race warning in `Task`

I am running Unit tests with Thread Sanitizer enabled and I am getting a Data Race warning when executing the statement try? await Task.sleep(nanoseconds: 10_000_000) Update I was able to reproduce the data race warning with only Swift Combine and…
CouchDeveloper
  • 18,174
  • 3
  • 45
  • 67