System Information
Operating system: Linux-5.6.13-arch1-1-x86_64-with-arch 64 Bits
Graphics card: AMD Radeon RX 5700 (NAVI10, DRM 3.36.0, 5.6.13-arch1-1, LLVM 10.0.0) X.Org 4.6 (Core Profile) Mesa 20.0.7
Blender Version
Broken: version: 2.83 (sub 17) and an older version from end of march (817c38f7).
Worked: (newest version of Blender that worked as expected)
Short description of error
When starting to sculpt, ASAN detects a heap-use-after-free error.
Exact steps for others to reproduce the error
- Apply P1400 (you can also skip this at first, this patch only helps to narrow down on one particular issue).
- Compile debug build with ASAN enabled.
- Start Blender.
- In default scene, switch to Sculpting workspace.
- Enable dynamic topology.
- Start making strokes. It should crash after one or two strokes with a message like P1399.
In P1400 I did the following:
- Disable threading for a couple of callbacks that would cause crashes as well.
- Added BKE_pbvh_parallel_range2 that executes a given callback in parallel, but with the c++ threads library instead of TBB. The result is the same.
- Disabled an assert that I ran into a couple of times, that does not seem to be harmful though.
- Added a mutex to pbvh_update_draw_buffer_cb for testing.
The issue is fixed by uncommenting the mutex in pbvh_update_draw_buffer_cb such that it is only executed by a single thread at once. I tried reducing the scope of the mutex, but still got crashes, it just took a bit longer.
So far, the issue only happened with dynamic topology enabled, it can also be related to that. I still could not narrow the issue down further.
I originally investigated this in T76544, but decided to make this a more specific separate report.