RenderKit / embree

Embree ray tracing kernels repository.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

global g_arena leading to crashes in Blender 3.6

ph0b opened this issue · comments

This global pointer to a task arena : https://github.com/embree/embree/blob/0fcb306c9176221219dd15e27fe0527ed334948f/kernels/rthwif/rtbuild/rtbuild.cpp#L219 gets reset when a device gets deleted, leading to crashes in Blender in the following scenario:

  1. users goes into render preview mode -> an embree device is created and kept alive.
  2. user triggers an offline renders -> a second embree device is created and deleted when render is done, https://github.com/embree/embree/blob/0fcb306c9176221219dd15e27fe0527ed334948f/kernels/rthwif/rtbuild/rtbuild.cpp#L219 called from its destructor, deletes the task arena
  3. user modifies anything in the scene being previewed -> BVH gets rebuilt using g_arena which is now nullptr, so
    https://github.com/embree/embree/blob/0fcb306c9176221219dd15e27fe0527ed334948f/kernels/rthwif/rtbuild/rtbuild.cpp#L743 triggers a read access violation embree::g_arena._Mypair._Myval2 was nullptr.

This task_arena got already changed in latest Embree to just be a static variable, thus it is no longer destroyed dynamically at all. Please check with latest Embree, issue should be gone.

Great! It may be done with your internal dev branch but that's not visible here, can you backport this change to 4.1 and/or make a new release soon ?

We are just 2 weeks away of a new release, likely happening around 20th July.

Ok.
I confirm switching from a pointer to a variable and getting rid of the dynamic destruction fixes the crash.
Opened https://projects.blender.org/blender/blender/pulls/109966 on the Blender side.