Page MenuHome

Crash on WIN32 running an operator with context overrides
Closed, ArchivedPublic

Description

System Information
Operating system: Windows-10-10.0.19041-SP0 64 Bits
Graphics card: Radeon (TM) RX 480 Graphics ATI Technologies Inc. 4.5.14736 Core Profile Context 20.10.1 27.20.12033.1007

Blender Version
Broken: version: 2.90.1, branch: master, commit date: 2020-09-23 06:43, hash: rB3e85bb34d0d7
Worked: --

Short description of error
when i use bpy.ops.screen.back_to_previous() in a addon blender crashes about every 5th time.

Exact steps for others to reproduce the error

Open any blend file and run the script, that should trigger the crash.

import bpy

i=0
while i < 1000: 
    for window in bpy.context.window_manager.windows:
        screen = window.screen
        for area in screen.areas:
            if area.type == 'VIEW_3D':             
                view_3d = area.spaces.active.region_3d
                override = {'window': window, 'screen': screen, 'area': area}                    
                bpy.ops.screen.screen_full_area(override)   

    bpy.ops.screen.back_to_previous()  
    print("loop:", i)
    i+=1

Stack trace:
python37.dll        :0x00007FFE4EDF89A0  PyErr_SetObject
python37.dll        :0x00007FFE4EDF8C20  PyErr_SetKeyError
python37.dll        :0x00007FFE4ED242A0  PyDict_DelItem_KnownHash
python37.dll        :0x00007FFE4ED27BB0  PyDict_DelItemString
blender.exe         :0x00007FF65C1C3CF0  BPY_context_dict_clear_members_array
blender.exe         :0x00007FF65BAD7BF0  CTX_wm_area_set
blender.exe         :0x00007FF65BDCF1F0  WM_event_remove_handlers
blender.exe         :0x00007FF65C1F0070  ED_area_exit
blender.exe         :0x00007FF65C1F0770  ED_screen_change
blender.exe         :0x00007FF65C1F1840  ED_screen_state_toggle
blender.exe         :0x00007FF65C205FA0  screen_maximize_area_exec
blender.exe         :0x00007FF65BDD6590  wm_operator_invoke
blender.exe         :0x00007FF65BDD5D30  wm_operator_call_internal
blender.exe         :0x00007FF65BDCF770  WM_operator_call_py
blender.exe         :0x00007FF65C1D5DF0  pyop_call
python37.dll        :0x00007FFE4ED16EE0  PyMethodDef_RawFastCallKeywords
python37.dll        :0x00007FFE4EDE3FA0  PyEval_GetFuncDesc
python37.dll        :0x00007FFE4EDDE490  PyEval_EvalFrameDefault
pydevd_frame_evaluator.cp37-win_amd64.pyd:0x00007FFE7F8A4BE0  PyInit_pydevd_frame_evaluator
python37.dll        :0x00007FFE4EDE2550  PyEval_EvalCodeWithName
python37.dll        :0x00007FFE4ED16740  PyFunction_FastCallDict
python37.dll        :0x00007FFE4ED17730  PyObject_Call_Prepend
python37.dll        :0x00007FFE4ED76D00  PyType_Ready
python37.dll        :0x00007FFE4ED162F0  PyObject_FastCallKeywords
python37.dll        :0x00007FFE4EDE3FA0  PyEval_GetFuncDesc
python37.dll        :0x00007FFE4EDDE490  PyEval_EvalFrameDefault
pydevd_frame_evaluator.cp37-win_amd64.pyd:0x00007FFE7F8A4BE0  PyInit_pydevd_frame_evaluator
python37.dll        :0x00007FFE4EDE2550  PyEval_EvalCodeWithName
python37.dll        :0x00007FFE4EDDE400  PyEval_EvalCode
blender.exe         :0x00007FF65C1C4E60  python_script_exec
blender.exe         :0x00007FF65C1C4CE0  BPY_run_text
blender.exe         :0x00007FF65C601DB0  text_run_script_exec
blender.exe         :0x00007FF65BDD6590  wm_operator_invoke
blender.exe         :0x00007FF65BDD5D30  wm_operator_call_internal
blender.exe         :0x00007FF65BDCF9E0  WM_operator_name_call_ptr
blender.exe         :0x00007FF65C4E7B50  ui_apply_but_funcs_after
blender.exe         :0x00007FF65C4F1CA0  ui_handler_region_menu
blender.exe         :0x00007FF65BDD5370  wm_handlers_do_intern
blender.exe         :0x00007FF65BDD49C0  wm_handlers_do
blender.exe         :0x00007FF65BDD1F20  wm_event_do_handlers
blender.exe         :0x00007FF65BDBD850  WM_main
blender.exe         :0x00007FF65BAC96E0  main
blender.exe         :0x00007FF65FF21EC8  __scrt_common_main_seh
KERNEL32.DLL        :0x00007FFEB1CB7020  BaseThreadInitThunk
ntdll.dll           :0x00007FFEB1EBD0B0  RtlUserThreadStart

Event Timeline

Philipp Oeser (lichtwerk) changed the task status from Needs Triage to Needs Information from User.Nov 10 2020, 9:42 AM

Cannot reproduce here (tested master and 2.90.1)

**System Information**
Operating system: Linux-5.8.18-300.fc33.x86_64-x86_64-with-fedora-33-Thirty_Three 64 Bits
Graphics card: GeForce GTX 970M/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 450.66
version: 2.92.0 Alpha, branch: master, commit date: 2020-11-10 08:09, hash: `rBd2ab9b568e85`

Could you provide crash logs?
https://docs.blender.org/manual/en/dev/troubleshooting/crash.html

Cannot reproduce on Windows either.

Very strange, yesterday and the past weeks it happend all the time and today i am not able to crash it any longer. There seems to be something else im doing which im not aware yet that seems to trigger the crashing. I will try to reproduce it again.

it seems only to happen when i start blender from visual studio code so i assume its some issue with having blender attached to VSC.

I assume its some issue with having blender attached to VSC

Maybe @Jacques Lucke (JacquesLucke) can reproduce?

These could still help

@dan grauer (kromar) Can you please provide the crash logs?

@dan grauer (kromar) You seem to be using the Steam version that doesn't have debug symbol. Could you please download a portable version (*.zip) of Blender, extract it and repeat the steps?

Robert Guetzkow (rjg) changed the task status from Needs Information from User to Needs Information from Developers.Dec 23 2020, 4:47 PM
Campbell Barton (campbellbarton) changed the task status from Needs Information from Developers to Needs Information from User.Jan 7 2021, 4:47 AM

@dan grauer (kromar) while I can't redo the error, the crash reported happens when setting the exception - which we can avoid.

Can you check if rBa9dea9cfaa756396153223f1eb2d8dc3161ded01 fixes the bug for you?

@Campbell Barton (campbellbarton) it is still crashing. I thought it was mentioned here that it is only crashing when blender is launched from Visual Studio Code. If i start blender without that it does not crash.

@dan grauer (kromar) could you submit a new back-trace? as it should not be crashing in the same place now.

since i build my own blender i attached visual studio to blender in hope of getting more info out of it. It shows a exception but im not experienced with debugging and source code so i would either need to get assistance on that or i could ask a friend to help on that who knows these things.

Unhandled exception at 0x00007FF87646CB83 (python37.dll) in blender.exe: 0xC0000094: Integer division by zero.

Robert Guetzkow (rjg) changed the task status from Needs Information from User to Needs Information from Developers.Jan 27 2021, 12:46 PM
Campbell Barton (campbellbarton) changed the task status from Needs Information from Developers to Needs Information from User.Jan 28 2021, 6:42 AM

@dan grauer (kromar) thanks for the update, I've tested this with a debug build of Python3.7 and 3.9, also with valgrind but I cant redo the error.


To debug this properly you would need the Python source (or build Python locally so you have the source+symbols).

Then the line of code that's crashing in Python could hint at the problem.

Would you be able to look into this?

Campbell Barton (campbellbarton) renamed this task from back_to_previous() crashes blender to Crash on WIN32 running an operator with context overrides.Jan 28 2021, 6:44 AM

@Campbell Barton (campbellbarton) i managed to get that working, i crashed blender a couple of times and got exceptions at 2 different places

File: Python-3.7.7\Objects\obmalloc.c
Line: 1423
Exception thrown: read access violation.
bp was nullptr.

File: Python-3.7.7\Objects\dictobject.c
Line: 1330

Exception thrown at 0x00007FFB33593D34 (python37.dll) in blender.exe: 0xC0000005: Access violation reading location 0x0000000000000058.

@dan grauer (kromar) Is this still an issue with Python 3.9 in Blender 2.93?

@Robert Guetzkow (rjg) i just tried with the latest master and it still crashes.

Philipp Oeser (lichtwerk) changed the task status from Needs Information from User to Needs Triage.Mar 24 2021, 1:49 PM

@dan grauer (kromar) thanks for the updated info, although I'm afraid this doesn't help narrow down the issue or point to an error in Blender's code.

Closing this report since nobody else has been able to redo the error.

While reports like this sometimes uncover errors in the code which are worth investigating and fixing, there is only so much we can do when the issue can't be recreated for investigation.