Repository navigation
Conversation
There was no documentation on using ThreadSanitizer with the free-threaded build beyond the configure option. Describe how to build, how extensions are instrumented, how to read a report, and how to run CPython's TSan tests, and note that TSan does not detect logic races in Python code.
|
I can't say I'm an expert on using TSAN only using what has been required to find some FT bugs in the past (so maybe some better people to have raised/reviewed this), from what I can see this is correct and enough to get started though |
The HOWTO sets the default highlight language to C, so the TSan report was lexed as C and raised a highlighting warning. Mark it, and the shell commands, with explicit languages.
Documentation build overview
|
| Enable ThreadSanitizer data race detector, ``tsan`` | ||
| (default is no). | ||
| (default is no). It is most useful together with :option:`--disable-gil`. | ||
| See :ref:`freethreading-tsan`. |
There was a problem hiding this comment.
This sentence is acutally needed?
There was a problem hiding this comment.
I had made this in relation to FT but Doc/howto/free-threading-extensions.rst change should be enough of a reference?
| SUMMARY: ThreadSanitizer: data race racy.c:8 in bump | ||
|
|
||
| The TSan runtime can be configured with the ``TSAN_OPTIONS`` environment | ||
| variable, for example ``TSAN_OPTIONS="suppressions=path/to/suppressions.txt"`` |
There was a problem hiding this comment.
This feels like it belongs in https://devguide.python.org/development-tools/sanitizers/ instead, but I'll leave the decision up to the free-threading experts.
Part of the free-threading docs tracking issue (gh-145912).
The only documentation of ThreadSanitizer was the one-line
--with-thread-sanitizerentry inusing/configure.rst. This adds a "Testing with ThreadSanitizer" section to the free-threading extensions HOWTO covering:--disable-gil --with-thread-sanitizer)TSAN_OPTIONS/ the suppressions file inTools/tsan/--tsan,--tsan-parallel)using/configure.rstnow links to it from--with-thread-sanitizer.