Page MenuHome

Crash on 2.80.30 race condition
Closed, ArchivedPublic

Description

System Information
macOS 10.13, 2x1080ti's, i9-7980XE

Blender Version
Build & Hash: (2.80.30 - a48bc157078)
This issue works only with: (Scenes with less objects - though the script ran perfectly fine in 2.79 with context.scene instead of context.depsgraph)

There appears to be a race condition when working with depsgraph to get mesh data and then removing the mesh to free up memory.

This issue occurs when rendering a scene with my custom add-on: Arnold Render engine.
Based on this script here:

@contextmanager
    def _Mesh(ob):
        pc = time.perf_counter()
        mesh = ob.to_mesh(depsgraph, apply_modifiers=True, calc_undeformed=True)
        if mesh is not None:
            try:
                mesh.calc_normals_split()
                arnold.AiMsgDebug(b"    mesh (%f)", ctypes.c_double(time.perf_counter() - pc))
                yield mesh
            finally:
                data.meshes.remove(mesh)
        else:
            yield None

Event Timeline

# Blender 2.80 (sub 30), Commit date: 2018-11-07 23:10, Hash a421cfa8d31
bpy.ops.object.editmode_toggle()  # Operator

# backtrace
0   blender                             0x00000001046ed0c7 BLI_system_backtrace + 55
1   blender                             0x0000000103ba9c0a sig_handle_crash + 362
2   libsystem_platform.dylib            0x00007fff59404f5a _sigtramp + 26
3   ???                                 0x000000012221efc0 0x0 + 4867616704
4   blender                             0x00000001043ab833 BKE_libblock_remap_locked + 531
5   blender                             0x00000001043ac607 BKE_libblock_delete + 183
6   blender                             0x000000010455f2a9 BlendDataMeshes_remove_call + 41
7   blender                             0x00000001044fbaa2 RNA_function_call + 18
8   blender                             0x0000000103f97784 pyrna_func_call + 2004
9   blender                             0x0000000105dd8ae1 _PyObject_FastCallKeywords + 577
10  blender                             0x0000000105eaaf2d call_function + 589
11  blender                             0x0000000105ea3002 _PyEval_EvalFrameDefault + 4114
12  blender                             0x0000000105de77d2 gen_send_ex + 242
13  blender                             0x0000000105ea0264 builtin_next + 100
14  blender                             0x0000000105dd992e _PyMethodDef_RawFastCallKeywords + 686
15  blender                             0x0000000105dd8ccc _PyCFunction_FastCallKeywords + 44
16  blender                             0x0000000105eaaec8 call_function + 488
17  blender                             0x0000000105ea3090 _PyEval_EvalFrameDefault + 4256
18  blender                             0x0000000105dd91c0 function_code_fastcall + 256
19  blender                             0x0000000105dd9c56 _PyObject_Call_Prepend + 150
20  blender                             0x0000000105dd84d8 _PyObject_FastCallDict + 360
21  blender                             0x0000000105ea2d73 _PyEval_EvalFrameDefault + 3459
22  blender                             0x0000000105eabd3a _PyEval_EvalCodeWithName + 2906
23  blender                             0x0000000105dd8c86 _PyFunction_FastCallKeywords + 230
24  blender                             0x0000000105eaaf58 call_function + 632
25  blender                             0x0000000105ea3126 _PyEval_EvalFrameDefault + 4406
26  blender                             0x0000000105dd91c0 function_code_fastcall + 256
27  blender                             0x0000000105eaaf58 call_function + 632
28  blender                             0x0000000105ea3002 _PyEval_EvalFrameDefault + 4114
29  blender                             0x0000000105dd91c0 function_code_fastcall + 256
30  blender                             0x0000000103f9ea01 bpy_class_call + 961
31  blender                             0x00000001045e5838 engine_update + 136
32  blender                             0x0000000103f6d0bb RE_engine_render + 907
33  blender                             0x0000000103f77754 do_render_all_options + 372
34  blender                             0x0000000103f772a8 RE_BlenderFrame + 200
35  blender                             0x0000000103eca047 render_startjob + 119
36  blender                             0x0000000103bbfa8f do_job_thread + 31
37  libsystem_pthread.dylib             0x00007fff5940e661 _pthread_body + 340
38  libsystem_pthread.dylib             0x00007fff5940e50d _pthread_body + 0
39  libsystem_pthread.dylib             0x00007fff5940dbf9 thread_start + 13

My apologies, I forgot to add the crash log. Thanks for your time.

Brecht Van Lommel (brecht) lowered the priority of this task from 90 to 30.EditedNov 12 2018, 2:08 AM

Please include a simple script that can be run to reproduce the problem. It's difficult to tell what is happening without more context. Race conditions normally happen with threading, which I guess is not the case here.

There is also some documentation on this topic:
https://wiki.blender.org/wiki/Reference/Release_Notes/2.80/Python_API/Scene_and_Object_API#Instancing

Bastien Montagne (mont29) changed the task status from Unknown Status to Unknown Status.Nov 22 2018, 12:04 PM
Bastien Montagne (mont29) claimed this task.

More than a week without reply or activity. Due to the policy of the tracker archiving for until required info/data are provided.