Crash calling Mesh.clear_geometry in edit-mode #90972

Closed
opened 2021-08-26 17:58:12 +02:00 by Paul Melis · 16 comments

System Information
Operating system: Arch Linux
Graphics card: GTX 970

Blender Version
Broken: 2.93.1, 2.92.0, 2.83.13

Short description of error

While trying to figure out a workaround for #90798 stumbled upon a segfault apparently caused by a call to bpy.ops.ed.undo() while in edit mode.

Exact steps for others to reproduce the error

$ cat t2.py
import bpy

# Assumes default cube already in the scene
bpy.ops.mesh.primitive_cube_add(location=(1,1,1))
    
bpy.data.objects['Cube'].select_set(True)
bpy.data.objects['Cube.001'].select_set(True)
bpy.context.view_layer.objects.active = bpy.data.objects['Cube']
bpy.ops.object.join()

bpy.ops.object.mode_set(mode = 'EDIT')
bpy.data.objects['Cube'].data.clear_geometry()
bpy.ops.ed.undo()

$ blender -P t2.py 
Read prefs: /home/melis/.config/blender/2.93/config/userpref.blend
Registered Animation Nodes
Traceback (most recent call last):
  File "/home/melis/t2.py", line 15, in <module>
    bpy.ops.ed.undo()
  File "/usr/share/blender/2.93/scripts/modules/bpy/ops.py", line 132, in __call__
    ret = _op_call(self.idname_py(), None, kw)
RuntimeError: Operator bpy.ops.ed.undo.poll() failed, context is incorrect
Writing: /tmp/blender.crash.txt
Segmentation fault (core dumped)

$ cat /tmp/blender.crash.txt 
# Blender 2.93.1, Commit date: 2021-06-22 05:57, Hash 1b8d33b18c2f
bpy.ops.mesh.primitive_cube_add(enter_editmode=False, align='WORLD', location=(1, 1, 1), scale=(1, 1, 1))  # Operator
bpy.ops.object.join()  # Operator
bpy.ops.object.select_all(action='DESELECT')  # Operator
bpy.ops.object.editmode_toggle()  # Operator

# backtrace
blender(BLI_system_backtrace+0x34) [0x5647b1133bb4]
blender(+0xe8fbf0) [0x5647ae9d8bf0]
/usr/lib/libc.so.6(+0x3cda0) [0x7f8fa1a3fda0]
blender(+0x2ef7f9e) [0x5647b0a40f9e]
blender(+0x2ef8401) [0x5647b0a41401]
blender(+0x2ef85e2) [0x5647b0a415e2]
blender(Screen_statusbar_info_call+0x3d) [0x5647af32defd]
blender(RNA_function_call+0x12) [0x5647af223612]
blender(+0x1873053) [0x5647af3bc053]
/usr/lib/libpython3.9.so.1.0(_PyObject_MakeTpCall+0x2e3) [0x7f8fa414f813]
/usr/lib/libpython3.9.so.1.0(_PyEval_EvalFrameDefault+0x52b5) [0x7f8fa414b6f5]
/usr/lib/libpython3.9.so.1.0(_PyFunction_Vectorcall+0x1bb) [0x7f8fa4156e3b]
blender(+0x1873dae) [0x5647af3bcdae]
blender(+0x1813898) [0x5647af35c898]
blender(ED_region_header_layout+0x18f) [0x5647af3d926f]
blender(ED_region_do_layout+0x60) [0x5647af3d7af0]
blender(wm_draw_update+0x447) [0x5647aedcc4a7]
blender(WM_main+0x34) [0x5647aedca1b4]
blender(main+0x370) [0x5647ae9a9420]
/usr/lib/libc.so.6(__libc_start_main+0xd5) [0x7f8fa1a2ab25]
blender(_start+0x2e) [0x5647ae9d4f8e]

# Python backtrace
  File "/usr/share/blender/2.93/scripts/startup/bl_ui/space_statusbar.py", line 46 in draw

GDB backtrace:

- 0  0x00005647b0a40f9e in stats_update ()
- 1  0x00005647b0a41401 in format_stats ()
- 2  0x00005647b0a415e2 in info_statusbar_string ()
- 3  0x00005647af32defd in Screen_statusbar_info_call ()
- 4  0x00005647af223612 in RNA_function_call ()
- 5  0x00005647af3bc053 in pyrna_func_call ()
- 6  0x00007f8fa414f813 in _PyObject_MakeTpCall () at /usr/lib/libpython3.9.so.1.0
- 7  0x00007f8fa414b6f5 in _PyEval_EvalFrameDefault () at /usr/lib/libpython3.9.so.1.0
- 8  0x00007f8fa4156e3b in _PyFunction_Vectorcall () at /usr/lib/libpython3.9.so.1.0
- 9  0x00005647af3bcdae in bpy_class_call ()
- 10 0x00005647af35c898 in header_draw ()
- 11 0x00005647af3d926f in ED_region_header_layout ()
- 12 0x00005647af3d7af0 in ED_region_do_layout ()
- 13 0x00005647aedcc4a7 in wm_draw_update ()
- 14 0x00005647aedca1b4 in WM_main ()
- 15 0x00005647ae9a9420 in main ()
**System Information** Operating system: Arch Linux Graphics card: GTX 970 **Blender Version** Broken: 2.93.1, 2.92.0, 2.83.13 **Short description of error** While trying to figure out a workaround for #90798 stumbled upon a segfault apparently caused by a call to `bpy.ops.ed.undo()` while in edit mode. **Exact steps for others to reproduce the error** ``` $ cat t2.py import bpy # Assumes default cube already in the scene bpy.ops.mesh.primitive_cube_add(location=(1,1,1)) bpy.data.objects['Cube'].select_set(True) bpy.data.objects['Cube.001'].select_set(True) bpy.context.view_layer.objects.active = bpy.data.objects['Cube'] bpy.ops.object.join() bpy.ops.object.mode_set(mode = 'EDIT') bpy.data.objects['Cube'].data.clear_geometry() bpy.ops.ed.undo() $ blender -P t2.py Read prefs: /home/melis/.config/blender/2.93/config/userpref.blend Registered Animation Nodes Traceback (most recent call last): File "/home/melis/t2.py", line 15, in <module> bpy.ops.ed.undo() File "/usr/share/blender/2.93/scripts/modules/bpy/ops.py", line 132, in __call__ ret = _op_call(self.idname_py(), None, kw) RuntimeError: Operator bpy.ops.ed.undo.poll() failed, context is incorrect Writing: /tmp/blender.crash.txt Segmentation fault (core dumped) $ cat /tmp/blender.crash.txt # Blender 2.93.1, Commit date: 2021-06-22 05:57, Hash 1b8d33b18c2f bpy.ops.mesh.primitive_cube_add(enter_editmode=False, align='WORLD', location=(1, 1, 1), scale=(1, 1, 1)) # Operator bpy.ops.object.join() # Operator bpy.ops.object.select_all(action='DESELECT') # Operator bpy.ops.object.editmode_toggle() # Operator # backtrace blender(BLI_system_backtrace+0x34) [0x5647b1133bb4] blender(+0xe8fbf0) [0x5647ae9d8bf0] /usr/lib/libc.so.6(+0x3cda0) [0x7f8fa1a3fda0] blender(+0x2ef7f9e) [0x5647b0a40f9e] blender(+0x2ef8401) [0x5647b0a41401] blender(+0x2ef85e2) [0x5647b0a415e2] blender(Screen_statusbar_info_call+0x3d) [0x5647af32defd] blender(RNA_function_call+0x12) [0x5647af223612] blender(+0x1873053) [0x5647af3bc053] /usr/lib/libpython3.9.so.1.0(_PyObject_MakeTpCall+0x2e3) [0x7f8fa414f813] /usr/lib/libpython3.9.so.1.0(_PyEval_EvalFrameDefault+0x52b5) [0x7f8fa414b6f5] /usr/lib/libpython3.9.so.1.0(_PyFunction_Vectorcall+0x1bb) [0x7f8fa4156e3b] blender(+0x1873dae) [0x5647af3bcdae] blender(+0x1813898) [0x5647af35c898] blender(ED_region_header_layout+0x18f) [0x5647af3d926f] blender(ED_region_do_layout+0x60) [0x5647af3d7af0] blender(wm_draw_update+0x447) [0x5647aedcc4a7] blender(WM_main+0x34) [0x5647aedca1b4] blender(main+0x370) [0x5647ae9a9420] /usr/lib/libc.so.6(__libc_start_main+0xd5) [0x7f8fa1a2ab25] blender(_start+0x2e) [0x5647ae9d4f8e] # Python backtrace File "/usr/share/blender/2.93/scripts/startup/bl_ui/space_statusbar.py", line 46 in draw ``` GDB backtrace: ``` - 0 0x00005647b0a40f9e in stats_update () - 1 0x00005647b0a41401 in format_stats () - 2 0x00005647b0a415e2 in info_statusbar_string () - 3 0x00005647af32defd in Screen_statusbar_info_call () - 4 0x00005647af223612 in RNA_function_call () - 5 0x00005647af3bc053 in pyrna_func_call () - 6 0x00007f8fa414f813 in _PyObject_MakeTpCall () at /usr/lib/libpython3.9.so.1.0 - 7 0x00007f8fa414b6f5 in _PyEval_EvalFrameDefault () at /usr/lib/libpython3.9.so.1.0 - 8 0x00007f8fa4156e3b in _PyFunction_Vectorcall () at /usr/lib/libpython3.9.so.1.0 - 9 0x00005647af3bcdae in bpy_class_call () - 10 0x00005647af35c898 in header_draw () - 11 0x00005647af3d926f in ED_region_header_layout () - 12 0x00005647af3d7af0 in ED_region_do_layout () - 13 0x00005647aedcc4a7 in wm_draw_update () - 14 0x00005647aedca1b4 in WM_main () - 15 0x00005647ae9a9420 in main () ```
Author

Added subscriber: @PaulMelis

Added subscriber: @PaulMelis

Added subscriber: @rjg

Added subscriber: @rjg

This crash only seems to happen when Blender is started with the script from CLI, executing it it from the Scripting workspace doesn't result in the crash.

Blender master branch:

****
## 4396==ERROR: AddressSanitizer: access-violation on unknown address 0x000000000058 (pc 0x7ff6a1ed430a bp 0x129410d740c0 sp 0x00bbad1fc910 T0)
## 4396==The signal is caused by a READ memory access.
## 4396==Hint: address points to the zero page.
    - 0 0x7ff6a1ed4309 in ui_but_value_get Z:\01_git\01_contribution\blender-git\blender\source\blender\editors\interface\interface.c:2517
    - 1 0x7ff6a1edc7ce in ui_but_is_pushed_ex Z:\01_git\01_contribution\blender-git\blender\source\blender\editors\interface\interface.c:2140
    - 2 0x7ff6a1eead4d in ui_but_update_select_flag Z:\01_git\01_contribution\blender-git\blender\source\blender\editors\interface\interface.c:2225
    - 3 0x7ff6a1eed349 in ui_but_update_ex Z:\01_git\01_contribution\blender-git\blender\source\blender\editors\interface\interface.c:3684
    - 4 0x7ff6a1edb300 in ui_but_update Z:\01_git\01_contribution\blender-git\blender\source\blender\editors\interface\interface.c:3853
    - 5 0x7ff6a1ef1bdd in ui_but_update_and_icon_set Z:\01_git\01_contribution\blender-git\blender\source\blender\editors\interface\interface.c:4904
    - 6 0x7ff6a1ec7814 in uiDefIconBut Z:\01_git\01_contribution\blender-git\blender\source\blender\editors\interface\interface.c:5286
    - 7 0x7ff6a1ef1df7 in uiDefIconButBit Z:\01_git\01_contribution\blender-git\blender\source\blender\editors\interface\interface.c:5309
    - 8 0x7ff6a1ec7d8f in uiDefIconButBitS Z:\01_git\01_contribution\blender-git\blender\source\blender\editors\interface\interface.c:5495
    - 9 0x7ff6a24f7750 in uiTemplateEditModeSelection Z:\01_git\01_contribution\blender-git\blender\source\blender\editors\space_view3d\view3d_header.c:143
    - 10 0x7ff6a24f7543 in uiTemplateHeader3D_mode Z:\01_git\01_contribution\blender-git\blender\source\blender\editors\space_view3d\view3d_header.c:234
    - 11 0x7ff6a0bce12d in UILayout_template_header_3D_mode_call Z:\01_git\01_contribution\blender-git\build_windows_Full_x64_vc16_Debug\source\blender\makesrna\intern\rna_ui_gen.c:3477
    - 12 0x7ff6a053e3b8 in RNA_function_call Z:\01_git\01_contribution\blender-git\blender\source\blender\makesrna\intern\rna_access.c:7618
    - 13 0x7ff6a0e67a52 in pyrna_func_call Z:\01_git\01_contribution\blender-git\blender\source\blender\python\intern\bpy_rna.c:6446
    - 14 0x7ff9439164d6 in PyErr_SyntaxLocationEx+0x282cdb (Z:\01_git\01_contribution\blender-git\build_windows_Full_x64_vc16_Debug\bin\Debug\python39_d.dll+0x1802864d6)
    - 15 0x7ff943bccbb9 in PyErr_SyntaxLocationEx+0x5393be (Z:\01_git\01_contribution\blender-git\build_windows_Full_x64_vc16_Debug\bin\Debug\python39_d.dll+0x18053cbb9)
    - 16 0x7ff943bcd1d1 in PyErr_SyntaxLocationEx+0x5399d6 (Z:\01_git\01_contribution\blender-git\build_windows_Full_x64_vc16_Debug\bin\Debug\python39_d.dll+0x18053d1d1)
    - 17 0x7ff943bc8465 in PyErr_SyntaxLocationEx+0x534c6a (Z:\01_git\01_contribution\blender-git\build_windows_Full_x64_vc16_Debug\bin\Debug\python39_d.dll+0x180538465)
    - 18 0x7ff943917866 in PyErr_SyntaxLocationEx+0x28406b (Z:\01_git\01_contribution\blender-git\build_windows_Full_x64_vc16_Debug\bin\Debug\python39_d.dll+0x180287866)
    - 19 0x7ff94391448b in PyErr_SyntaxLocationEx+0x280c90 (Z:\01_git\01_contribution\blender-git\build_windows_Full_x64_vc16_Debug\bin\Debug\python39_d.dll+0x18028448b)
    - 20 0x7ff943bccbc9 in PyErr_SyntaxLocationEx+0x5393ce (Z:\01_git\01_contribution\blender-git\build_windows_Full_x64_vc16_Debug\bin\Debug\python39_d.dll+0x18053cbc9)
    - 21 0x7ff943bcd1d1 in PyErr_SyntaxLocationEx+0x5399d6 (Z:\01_git\01_contribution\blender-git\build_windows_Full_x64_vc16_Debug\bin\Debug\python39_d.dll+0x18053d1d1)
    - 22 0x7ff943bc4053 in PyErr_SyntaxLocationEx+0x530858 (Z:\01_git\01_contribution\blender-git\build_windows_Full_x64_vc16_Debug\bin\Debug\python39_d.dll+0x180534053)
    - 23 0x7ff943bc1b79 in PyErr_SyntaxLocationEx+0x52e37e (Z:\01_git\01_contribution\blender-git\build_windows_Full_x64_vc16_Debug\bin\Debug\python39_d.dll+0x180531b79)
    - 24 0x7ff943914945 in PyErr_SyntaxLocationEx+0x28114a (Z:\01_git\01_contribution\blender-git\build_windows_Full_x64_vc16_Debug\bin\Debug\python39_d.dll+0x180284945)
    - 25 0x7ff943913e79 in PyErr_SyntaxLocationEx+0x28067e (Z:\01_git\01_contribution\blender-git\build_windows_Full_x64_vc16_Debug\bin\Debug\python39_d.dll+0x180283e79)
    - 26 0x7ff943914c82 in PyErr_SyntaxLocationEx+0x281487 (Z:\01_git\01_contribution\blender-git\build_windows_Full_x64_vc16_Debug\bin\Debug\python39_d.dll+0x180284c82)
    - 27 0x7ff943913347 in PyErr_SyntaxLocationEx+0x27fb4c (Z:\01_git\01_contribution\blender-git\build_windows_Full_x64_vc16_Debug\bin\Debug\python39_d.dll+0x180283347)
    - 28 0x7ff6a0e6cdd4 in bpy_class_call Z:\01_git\01_contribution\blender-git\blender\source\blender\python\intern\bpy_rna.c:8699
    - 29 0x7ff6a0bb3b01 in header_draw Z:\01_git\01_contribution\blender-git\blender\source\blender\makesrna\intern\rna_ui.c:762
    - 30 0x7ff6a0f04769 in ED_region_header_layout Z:\01_git\01_contribution\blender-git\blender\source\blender\editors\screen\area.c:3294
    - 31 0x7ff6a0f041cc in ED_region_header Z:\01_git\01_contribution\blender-git\blender\source\blender\editors\screen\area.c:3361
    - 32 0x7ff6a24f434c in view3d_header_region_draw Z:\01_git\01_contribution\blender-git\blender\source\blender\editors\space_view3d\space_view3d.c:1211
    - 33 0x7ff6a0effc54 in ED_region_do_draw Z:\01_git\01_contribution\blender-git\blender\source\blender\editors\screen\area.c:564
    - 34 0x7ff69f01d021 in wm_draw_window_offscreen Z:\01_git\01_contribution\blender-git\blender\source\blender\windowmanager\intern\wm_draw.c:728
    - 35 0x7ff69f01d9b4 in wm_draw_window Z:\01_git\01_contribution\blender-git\blender\source\blender\windowmanager\intern\wm_draw.c:877
    - 36 0x7ff69f0182ec in wm_draw_update Z:\01_git\01_contribution\blender-git\blender\source\blender\windowmanager\intern\wm_draw.c:1078
    - 37 0x7ff69efb7a85 in ghost_event_proc Z:\01_git\01_contribution\blender-git\blender\source\blender\windowmanager\intern\wm_window.c:1351
    - 38 0x7ff6a2a1fccf in GHOST_CallbackEventConsumer::processEvent Z:\01_git\01_contribution\blender-git\blender\intern\ghost\intern\GHOST_CallbackEventConsumer.cpp:41
    - 39 0x7ff6a2aa4f93 in GHOST_EventManager::dispatchEvent Z:\01_git\01_contribution\blender-git\blender\intern\ghost\intern\GHOST_EventManager.cpp:84
    - 40 0x7ff6a2aa518c in GHOST_EventManager::dispatchEvent Z:\01_git\01_contribution\blender-git\blender\intern\ghost\intern\GHOST_EventManager.cpp:94
    - 41 0x7ff6a2aa5202 in GHOST_EventManager::dispatchEvents Z:\01_git\01_contribution\blender-git\blender\intern\ghost\intern\GHOST_EventManager.cpp:100
    - 42 0x7ff6a2ab9db7 in GHOST_System::dispatchEvents Z:\01_git\01_contribution\blender-git\blender\intern\ghost\intern\GHOST_System.cpp:218
    - 43 0x7ff6a29e4a87 in GHOST_DispatchEvents Z:\01_git\01_contribution\blender-git\blender\intern\ghost\intern\GHOST_C-api.cpp:263
    - 44 0x7ff69efb1b6e in wm_window_process_events Z:\01_git\01_contribution\blender-git\blender\source\blender\windowmanager\intern\wm_window.c:1557
    - 45 0x7ff69ef904e3 in WM_main Z:\01_git\01_contribution\blender-git\blender\source\blender\windowmanager\intern\wm.c:645
    - 46 0x7ff69dc4e476 in main Z:\01_git\01_contribution\blender-git\blender\source\creator\creator.c:558
    - 47 0x7ff6abd507b8 in invoke_main d:\agent\_work\4\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:78
    - 48 0x7ff6abd5070d in __scrt_common_main_seh d:\agent\_work\4\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288
    - 49 0x7ff6abd505cd in __scrt_common_main d:\agent\_work\4\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:330
    - 50 0x7ff6abd5082d in mainCRTStartup d:\agent\_work\4\s\src\vctools\crt\vcstartup\src\startup\exe_main.cpp:16
    - 51 0x7ff995ea7033 in BaseThreadInitThunk+0x13 (C:\WINDOWS\System32\KERNEL32.dll+0x180017033)
    #52 0x7ff996062650 in RtlUserThreadStart+0x20 (C:\WINDOWS\SYSTEM32\ntdll.dll+0x180052650)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: access-violation Z:\01_git\01_contribution\blender-git\blender\source\blender\editors\interface\interface.c:2517 in ui_but_value_get
## 4396==ABORTING

The undo call doesn't appear to be the issue. It's the clear_geometry() that seems to cause the problem.

This crash only seems to happen when Blender is started with the script from CLI, executing it it from the Scripting workspace doesn't result in the crash. Blender master branch: ```lines **** ## 4396==ERROR: AddressSanitizer: access-violation on unknown address 0x000000000058 (pc 0x7ff6a1ed430a bp 0x129410d740c0 sp 0x00bbad1fc910 T0) ## 4396==The signal is caused by a READ memory access. ## 4396==Hint: address points to the zero page. - 0 0x7ff6a1ed4309 in ui_but_value_get Z:\01_git\01_contribution\blender-git\blender\source\blender\editors\interface\interface.c:2517 - 1 0x7ff6a1edc7ce in ui_but_is_pushed_ex Z:\01_git\01_contribution\blender-git\blender\source\blender\editors\interface\interface.c:2140 - 2 0x7ff6a1eead4d in ui_but_update_select_flag Z:\01_git\01_contribution\blender-git\blender\source\blender\editors\interface\interface.c:2225 - 3 0x7ff6a1eed349 in ui_but_update_ex Z:\01_git\01_contribution\blender-git\blender\source\blender\editors\interface\interface.c:3684 - 4 0x7ff6a1edb300 in ui_but_update Z:\01_git\01_contribution\blender-git\blender\source\blender\editors\interface\interface.c:3853 - 5 0x7ff6a1ef1bdd in ui_but_update_and_icon_set Z:\01_git\01_contribution\blender-git\blender\source\blender\editors\interface\interface.c:4904 - 6 0x7ff6a1ec7814 in uiDefIconBut Z:\01_git\01_contribution\blender-git\blender\source\blender\editors\interface\interface.c:5286 - 7 0x7ff6a1ef1df7 in uiDefIconButBit Z:\01_git\01_contribution\blender-git\blender\source\blender\editors\interface\interface.c:5309 - 8 0x7ff6a1ec7d8f in uiDefIconButBitS Z:\01_git\01_contribution\blender-git\blender\source\blender\editors\interface\interface.c:5495 - 9 0x7ff6a24f7750 in uiTemplateEditModeSelection Z:\01_git\01_contribution\blender-git\blender\source\blender\editors\space_view3d\view3d_header.c:143 - 10 0x7ff6a24f7543 in uiTemplateHeader3D_mode Z:\01_git\01_contribution\blender-git\blender\source\blender\editors\space_view3d\view3d_header.c:234 - 11 0x7ff6a0bce12d in UILayout_template_header_3D_mode_call Z:\01_git\01_contribution\blender-git\build_windows_Full_x64_vc16_Debug\source\blender\makesrna\intern\rna_ui_gen.c:3477 - 12 0x7ff6a053e3b8 in RNA_function_call Z:\01_git\01_contribution\blender-git\blender\source\blender\makesrna\intern\rna_access.c:7618 - 13 0x7ff6a0e67a52 in pyrna_func_call Z:\01_git\01_contribution\blender-git\blender\source\blender\python\intern\bpy_rna.c:6446 - 14 0x7ff9439164d6 in PyErr_SyntaxLocationEx+0x282cdb (Z:\01_git\01_contribution\blender-git\build_windows_Full_x64_vc16_Debug\bin\Debug\python39_d.dll+0x1802864d6) - 15 0x7ff943bccbb9 in PyErr_SyntaxLocationEx+0x5393be (Z:\01_git\01_contribution\blender-git\build_windows_Full_x64_vc16_Debug\bin\Debug\python39_d.dll+0x18053cbb9) - 16 0x7ff943bcd1d1 in PyErr_SyntaxLocationEx+0x5399d6 (Z:\01_git\01_contribution\blender-git\build_windows_Full_x64_vc16_Debug\bin\Debug\python39_d.dll+0x18053d1d1) - 17 0x7ff943bc8465 in PyErr_SyntaxLocationEx+0x534c6a (Z:\01_git\01_contribution\blender-git\build_windows_Full_x64_vc16_Debug\bin\Debug\python39_d.dll+0x180538465) - 18 0x7ff943917866 in PyErr_SyntaxLocationEx+0x28406b (Z:\01_git\01_contribution\blender-git\build_windows_Full_x64_vc16_Debug\bin\Debug\python39_d.dll+0x180287866) - 19 0x7ff94391448b in PyErr_SyntaxLocationEx+0x280c90 (Z:\01_git\01_contribution\blender-git\build_windows_Full_x64_vc16_Debug\bin\Debug\python39_d.dll+0x18028448b) - 20 0x7ff943bccbc9 in PyErr_SyntaxLocationEx+0x5393ce (Z:\01_git\01_contribution\blender-git\build_windows_Full_x64_vc16_Debug\bin\Debug\python39_d.dll+0x18053cbc9) - 21 0x7ff943bcd1d1 in PyErr_SyntaxLocationEx+0x5399d6 (Z:\01_git\01_contribution\blender-git\build_windows_Full_x64_vc16_Debug\bin\Debug\python39_d.dll+0x18053d1d1) - 22 0x7ff943bc4053 in PyErr_SyntaxLocationEx+0x530858 (Z:\01_git\01_contribution\blender-git\build_windows_Full_x64_vc16_Debug\bin\Debug\python39_d.dll+0x180534053) - 23 0x7ff943bc1b79 in PyErr_SyntaxLocationEx+0x52e37e (Z:\01_git\01_contribution\blender-git\build_windows_Full_x64_vc16_Debug\bin\Debug\python39_d.dll+0x180531b79) - 24 0x7ff943914945 in PyErr_SyntaxLocationEx+0x28114a (Z:\01_git\01_contribution\blender-git\build_windows_Full_x64_vc16_Debug\bin\Debug\python39_d.dll+0x180284945) - 25 0x7ff943913e79 in PyErr_SyntaxLocationEx+0x28067e (Z:\01_git\01_contribution\blender-git\build_windows_Full_x64_vc16_Debug\bin\Debug\python39_d.dll+0x180283e79) - 26 0x7ff943914c82 in PyErr_SyntaxLocationEx+0x281487 (Z:\01_git\01_contribution\blender-git\build_windows_Full_x64_vc16_Debug\bin\Debug\python39_d.dll+0x180284c82) - 27 0x7ff943913347 in PyErr_SyntaxLocationEx+0x27fb4c (Z:\01_git\01_contribution\blender-git\build_windows_Full_x64_vc16_Debug\bin\Debug\python39_d.dll+0x180283347) - 28 0x7ff6a0e6cdd4 in bpy_class_call Z:\01_git\01_contribution\blender-git\blender\source\blender\python\intern\bpy_rna.c:8699 - 29 0x7ff6a0bb3b01 in header_draw Z:\01_git\01_contribution\blender-git\blender\source\blender\makesrna\intern\rna_ui.c:762 - 30 0x7ff6a0f04769 in ED_region_header_layout Z:\01_git\01_contribution\blender-git\blender\source\blender\editors\screen\area.c:3294 - 31 0x7ff6a0f041cc in ED_region_header Z:\01_git\01_contribution\blender-git\blender\source\blender\editors\screen\area.c:3361 - 32 0x7ff6a24f434c in view3d_header_region_draw Z:\01_git\01_contribution\blender-git\blender\source\blender\editors\space_view3d\space_view3d.c:1211 - 33 0x7ff6a0effc54 in ED_region_do_draw Z:\01_git\01_contribution\blender-git\blender\source\blender\editors\screen\area.c:564 - 34 0x7ff69f01d021 in wm_draw_window_offscreen Z:\01_git\01_contribution\blender-git\blender\source\blender\windowmanager\intern\wm_draw.c:728 - 35 0x7ff69f01d9b4 in wm_draw_window Z:\01_git\01_contribution\blender-git\blender\source\blender\windowmanager\intern\wm_draw.c:877 - 36 0x7ff69f0182ec in wm_draw_update Z:\01_git\01_contribution\blender-git\blender\source\blender\windowmanager\intern\wm_draw.c:1078 - 37 0x7ff69efb7a85 in ghost_event_proc Z:\01_git\01_contribution\blender-git\blender\source\blender\windowmanager\intern\wm_window.c:1351 - 38 0x7ff6a2a1fccf in GHOST_CallbackEventConsumer::processEvent Z:\01_git\01_contribution\blender-git\blender\intern\ghost\intern\GHOST_CallbackEventConsumer.cpp:41 - 39 0x7ff6a2aa4f93 in GHOST_EventManager::dispatchEvent Z:\01_git\01_contribution\blender-git\blender\intern\ghost\intern\GHOST_EventManager.cpp:84 - 40 0x7ff6a2aa518c in GHOST_EventManager::dispatchEvent Z:\01_git\01_contribution\blender-git\blender\intern\ghost\intern\GHOST_EventManager.cpp:94 - 41 0x7ff6a2aa5202 in GHOST_EventManager::dispatchEvents Z:\01_git\01_contribution\blender-git\blender\intern\ghost\intern\GHOST_EventManager.cpp:100 - 42 0x7ff6a2ab9db7 in GHOST_System::dispatchEvents Z:\01_git\01_contribution\blender-git\blender\intern\ghost\intern\GHOST_System.cpp:218 - 43 0x7ff6a29e4a87 in GHOST_DispatchEvents Z:\01_git\01_contribution\blender-git\blender\intern\ghost\intern\GHOST_C-api.cpp:263 - 44 0x7ff69efb1b6e in wm_window_process_events Z:\01_git\01_contribution\blender-git\blender\source\blender\windowmanager\intern\wm_window.c:1557 - 45 0x7ff69ef904e3 in WM_main Z:\01_git\01_contribution\blender-git\blender\source\blender\windowmanager\intern\wm.c:645 - 46 0x7ff69dc4e476 in main Z:\01_git\01_contribution\blender-git\blender\source\creator\creator.c:558 - 47 0x7ff6abd507b8 in invoke_main d:\agent\_work\4\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:78 - 48 0x7ff6abd5070d in __scrt_common_main_seh d:\agent\_work\4\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288 - 49 0x7ff6abd505cd in __scrt_common_main d:\agent\_work\4\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:330 - 50 0x7ff6abd5082d in mainCRTStartup d:\agent\_work\4\s\src\vctools\crt\vcstartup\src\startup\exe_main.cpp:16 - 51 0x7ff995ea7033 in BaseThreadInitThunk+0x13 (C:\WINDOWS\System32\KERNEL32.dll+0x180017033) #52 0x7ff996062650 in RtlUserThreadStart+0x20 (C:\WINDOWS\SYSTEM32\ntdll.dll+0x180052650) AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: access-violation Z:\01_git\01_contribution\blender-git\blender\source\blender\editors\interface\interface.c:2517 in ui_but_value_get ## 4396==ABORTING ``` The undo call doesn't appear to be the issue. It's the `clear_geometry()` that seems to cause the problem.
Member

Added subscriber: @PratikPB2123

Added subscriber: @PratikPB2123
Member

Commit should fix the issue (I think): 1b7c361fbb

I did not receive crash when running blender from CMD (without GUI)

Commit should fix the issue (I think): 1b7c361fbb I did not receive crash when running blender from CMD (without GUI)
Member

Added subscribers: @ideasman42, @lichtwerk

Added subscribers: @ideasman42, @lichtwerk
Member

Changed status from 'Needs Triage' to: 'Needs User Info'

Changed status from 'Needs Triage' to: 'Needs User Info'
Member

I can confirm here.

However, this is somewhat expected. Let me explain:

In #90972#1212294, @PratikPB2123 wrote:
Commit should fix the issue (I think): 1b7c361fbb

In blender/blender-addons#60934#615703, @ideasman42 wrote:
Committed basic undo system support in background mode: 3d16a268ee

You'll need to perform an undo push explicitly to initialize undo, afterwards you can use undo to restore the state.

So 3d16a268ee should have brought basic support for undo in background mode back.
But it also advises to do a "manual" undo push here to make it work properly. Doing so will get rid of the crash.
(i can also imagine this is specifically problematic, because clear_geometry() is not an operator that has an undo push for itself, but a mesh RNA function without undo push)

Sooo, doing it with this script, I dont get crashes anymore:

import bpy

# Assumes default cube already in the scene
bpy.ops.mesh.primitive_cube_add(location=(1,1,1))
    
bpy.data.objects['Cube'].select_set(True)
bpy.data.objects['Cube.001'].select_set(True)
bpy.context.view_layer.objects.active = bpy.data.objects['Cube']
bpy.ops.object.join()

bpy.ops.object.mode_set(mode = 'EDIT')
bpy.ops.ed.undo_push(message='Add an undo step')
bpy.data.objects['Cube'].data.clear_geometry()
bpy.ops.ed.undo()

@PaulMelis: does this work for you?

I can confirm here. However, this is somewhat expected. Let me explain: > In #90972#1212294, @PratikPB2123 wrote: > Commit should fix the issue (I think): 1b7c361fbb > In blender/blender-addons#60934#615703, @ideasman42 wrote: > Committed basic undo system support in background mode: 3d16a268ee > > You'll need to perform an undo push explicitly to initialize undo, afterwards you can use undo to restore the state. So 3d16a268ee should have brought basic support for undo in background mode back. But it also advises to do a "manual" undo push here to make it work properly. Doing so will get rid of the crash. (i can also imagine this is specifically problematic, because `clear_geometry()` is not an operator that has an undo push for itself, but a mesh RNA function without undo push) Sooo, doing it with this script, I dont get crashes anymore: ``` import bpy # Assumes default cube already in the scene bpy.ops.mesh.primitive_cube_add(location=(1,1,1)) bpy.data.objects['Cube'].select_set(True) bpy.data.objects['Cube.001'].select_set(True) bpy.context.view_layer.objects.active = bpy.data.objects['Cube'] bpy.ops.object.join() bpy.ops.object.mode_set(mode = 'EDIT') bpy.ops.ed.undo_push(message='Add an undo step') bpy.data.objects['Cube'].data.clear_geometry() bpy.ops.ed.undo() ``` @PaulMelis: does this work for you?
Author

Well, that indeed doesn't crash. However, I had already found another workaround, but thanks anyway!

Well, that indeed doesn't crash. However, I had already found another workaround, but thanks anyway!
Member

Changed status from 'Needs User Info' to: 'Archived'

Changed status from 'Needs User Info' to: 'Archived'
Member

In #90972#1214572, @PaulMelis wrote:
Well, that indeed doesn't crash. However, I had already found another workaround, but thanks anyway!

Will close then.
Out of curiosity : which workaround did you use?

> In #90972#1214572, @PaulMelis wrote: > Well, that indeed doesn't crash. However, I had already found another workaround, but thanks anyway! Will close then. Out of curiosity : which workaround did you use?
Author

See https://developer.blender.org/T90798:

bm = bmesh.new()
bm.from_mesh(msh)
bm.to_mesh(msh)
bm.free()

This makes sure the loop triangles are flagged to be recomputed, which is what I needed (as glTF export was broken for our scene)

See https://developer.blender.org/T90798: ``` bm = bmesh.new() bm.from_mesh(msh) bm.to_mesh(msh) bm.free() ``` This makes sure the loop triangles are flagged to be recomputed, which is what I needed (as glTF export was broken for our scene)
Campbell Barton changed title from Segfault when calling bpy.ops.ed.undo() to Crash calling Mesh.clear_geometry in edit-mode 2021-09-02 07:24:08 +02:00
Campbell Barton self-assigned this 2021-09-02 07:24:34 +02:00

Changed status from 'Archived' to: 'Confirmed'

Changed status from 'Archived' to: 'Confirmed'

This crash also happens when undo isn't called.

This crash also happens when undo isn't called.

This issue was referenced by 19e1b5c1fd

This issue was referenced by 19e1b5c1fd61b622382c2cf7d782e99f6cb8c64b

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
6 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#90972
No description provided.