-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Possible data race reported by clang thread sanitizer #1290
Comments
The following minimal example also produces a data race detected by ThreadSanitizer: std::vector<std::uint64_t> v(1'000'000);
std::mt19937 gen {std::random_device{}()};
std::ranges::generate(v, gen);
std::sort(std::execution::par, v.begin(), v.end()); Error produced:
I am using ❯ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/13/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,fortran,objc,obj-c++,ada,go,d,m2,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --enable-libstdcxx-backtrace --with-libstdcxx-zoneinfo=/usr/share/zoneinfo --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --with-isl=/builddir/build/BUILD/gcc-13.2.1-20231205/obj-x86_64-redhat-linux/isl-install --enable-offload-targets=nvptx-none --without-cuda-driver --enable-offload-defaulted --enable-gnu-indirect-function --enable-cet --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux --with-build-config=bootstrap-lto --enable-link-serialization=1
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 13.2.1 20231205 (Red Hat 13.2.1-6) (GCC) |
Hi @emmenlau, @Alejandro-FA, could you please try to rebuild TBB with ThreadSanitizer support . |
Hi @pavelkumbrasev, I have tried it but I get an error in the build process. I have configured the project as follows: cd /tmp
git clone https://github.com/oneapi-src/oneTBB.git
cd oneTBB
mkdir cmake-build && cd cmake-build
cmake -DCMAKE_INSTALL_PREFIX=/tmp/intel/oneTBB_tsan -DTBB_SANITIZE=thread .. Here is the output of the configuration process:
And when doing
|
From your comment, do I understand correctly that if I want to use Thread Sanitizer with my application, I need to build oneTBB with Thread Sanitizer support? At the moment I simply installed oneTBB following these instructions: https://www.intel.com/content/www/us/en/docs/onetbb/get-started-guide/2021-6/install-onetbb-on-linux-os.html |
@Alejandro-FA, it might lead to unexpected false positive reports that will lead into TBB. So to properly test application that use TBB it also should be built with TSan support. The error you got probably related to GNU 13.2.1 (we didn't test TSan with this version yet) (problem). Could you please try to build it with different version (GNU < 11 should be fine). |
@emmenlau is this issue still relevant? |
Sorry for not getting back to this! I did not have time to look into it any further. It's well possible that there is no problem, but I would need to follow it up by building our whole tech stack with TSan, to be sure. Is it fine to leave the issue open a bit longer? |
Sure, no problem. Please let us know if there still an issue we will look into that. |
We have found a possible data race reported when using OpenCV
resize
method, and reported it in opencv/opencv#24063. It seems that the origin is in oneTBB, so copying the report here:As far as we can see there is nothing specific in our build that would explain the issue. We have just reproduced the issue again with OpenCV 4.9.0 (current latest), oneTBB 2021.10.0 and clang 17.x on Linux. Previously the issue could be experienced with lower version numbers of all tools as well.
Here is what we did:
resize()
, with clang on Linux in debug mode, and enable thread sanitizer in the build:-fsanitize=thread
to compile and link arguments list of clangThe executable will print:
The text was updated successfully, but these errors were encountered: