According to the parallel_reduce documentation, the operator() can run concurrently with the split constructor. This this update to mRadius and mIndex is potentially unsafe, and should use an atomic. I don't think it will change the result, but it will make TSan happy at least.
For reference here is the full stack-trace on the first TSan issue I ran into: tsan_log.txt
Environment
Operating System: macOS/Linux Version / Commit SHA: OpenVDB 11.0.0, OneTBB v2021.11.0 Other: C++17
Describe the bug
While running ThreadSanitizer on a unit test with the
fillWithSpheres()
function, I think I uncovered a potential thread-safety issue at the following location: https://github.com/AcademySoftwareFoundation/openvdb/blob/605970fc1e374f4a84eaacc836f64a93e4f298a9/openvdb/openvdb/tools/VolumeToSpheres.h#L553-L554According to the parallel_reduce documentation, the
operator()
can run concurrently with the split constructor. This this update tomRadius
andmIndex
is potentially unsafe, and should use an atomic. I don't think it will change the result, but it will make TSan happy at least.For reference here is the full stack-trace on the first TSan issue I ran into: tsan_log.txt