RenderKit / embree

Embree ray tracing kernels repository.
Apache License 2.0
2.32k stars 383 forks source link

ThreadSanitizer issue in parallel_any_of #469

Open jdumas opened 6 months ago

jdumas commented 6 months ago

The following line: https://github.com/embree/embree/blob/be0accfd0b246e2b03355b8ee7710a22c1b49240/common/algorithms/parallel_any_of.h#L24 is causing ThreadSanitizer to be unhappy when I run some unit tests with Embree, due to a concurrent writes to the same local variable. Even though it won't change the result, I suggest changing this to an atomic bool or an atomic flag to make Thread Sanitizer happy.

If it's any help, here is the TSan stack trace I obtained when testing (I tried with Embree 3.13.5, but the latest version has the same issue): tsan_log.txt

dopitz commented 5 months ago

Hi, this should be fixed with changing ret to an atomic_bool and is included in the next embree release.

Could you elaborate a bit what exactly you did in your testing? We might want to include that into our CI as well.

jdumas commented 5 months ago

Sure. I don't have a MWE, but the code that produced the stack trace above is coming from this unit test. It seems that a call to rtcCommitScene() was enough to trigger TSan.