-
-
Notifications
You must be signed in to change notification settings - Fork 30.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for thread sanitizer (TSAN) via --with-thread-sanitizer
#112536
Comments
Hey, Happy to get some initial feedback on it and then add remaining things like _Py_THREAD_SANITIZER etc. |
Added Still looking for a good way to enable TSAN for the continuous build, I will make another PR when I find one. |
…--with-thread-sanitizer" This reverts commit a97883f.
Do we want to backport these at some point? |
|
Ok, closing as done now. |
--------- Co-authored-by: Antoine Pitrou <antoine@python.org>
These may all exercise some non-trivial aspects of thread synchronization.
--------- Co-authored-by: Antoine Pitrou <antoine@python.org>
These may all exercise some non-trivial aspects of thread synchronization.
…abled The `__has_feature(thread_sanitizer)` is a Clang-ism. Although new versions of GCC implement `__has_feature`, the `defined(__has_feature)` check still fails on GCC so we don't use that code path.
…117702) The `__has_feature(thread_sanitizer)` is a Clang-ism. Although new versions of GCC implement `__has_feature`, the `defined(__has_feature)` check still fails on GCC so we don't use that code path.
…abled (pythonGH-117702) The `__has_feature(thread_sanitizer)` is a Clang-ism. Although new versions of GCC implement `__has_feature`, the `defined(__has_feature)` check still fails on GCC so we don't use that code path. (cherry picked from commit 79eec66) Co-authored-by: Sam Gross <colesbury@gmail.com>
…nabled (GH-117702) (#117713) gh-112536: Define `_Py_THREAD_SANITIZER` on GCC when TSan is enabled (GH-117702) The `__has_feature(thread_sanitizer)` is a Clang-ism. Although new versions of GCC implement `__has_feature`, the `defined(__has_feature)` check still fails on GCC so we don't use that code path. (cherry picked from commit 79eec66) Co-authored-by: Sam Gross <colesbury@gmail.com>
--------- Co-authored-by: Antoine Pitrou <antoine@python.org>
These may all exercise some non-trivial aspects of thread synchronization.
…abled (python#117702) The `__has_feature(thread_sanitizer)` is a Clang-ism. Although new versions of GCC implement `__has_feature`, the `defined(__has_feature)` check still fails on GCC so we don't use that code path.
hello, possible to backport this to 3.10 too ? |
Unfortunately, 3.8 to 3.11 are security-only branches. As such, they would not accept such backports. The 3.11 backport was not merged since it was close to the last bugfix deadline. |
Feature or enhancement
GCC and Clang provide ThreadSanitizer, a tool that detects data races. We should add support for thread sanitizer to CPython. Note that Python already supports the memory and address sanitizers.
--with-thread-sanitizer
as a configure option_Py_THREAD_SANITIZER
if thread-sanitizer is enabled (see, e.g.,_Py_ADDRESS_SANITIZER
inpyport.h
)_Py_NO_SANITIZE_THREAD
fromobmalloc.c
to a place that's more widely available (likepyport.h
). We're going to need this in a few placesEventually, it would be helpful to have a continuous build for the combination of
--disable-gil --with-thread-sanitizer
. Note that we probably won't want to run all the tests. ThreadSanitizer is slow and also not very useful for single-threaded tests. We should collect a subset of our tests that use threading for the ThreadSanitizer continuous build.Linked PRs
_Py_THREAD_SANITIZER
on GCC when TSan is enabled #117702_Py_THREAD_SANITIZER
on GCC when TSan is enabled (GH-117702) #117713The text was updated successfully, but these errors were encountered: