Crash on WIN32 running an operator with context overrides #82552

Closed
opened 2020-11-09 22:02:54 +01:00 by Daniel Grauer · 30 comments
Member

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: 3e85bb34d0
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
    
    

back_to_previous.blend

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
**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: `3e85bb34d0` 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 ``` [back_to_previous.blend](https://archive.blender.org/developer/F9247862/back_to_previous.blend) ```lines 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 ```
Author
Member

Added subscriber: @DanielGrauer

Added subscriber: @DanielGrauer
Member

Added subscriber: @lichtwerk

Added subscriber: @lichtwerk
Member

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

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

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 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

Added subscriber: @rjg

Added subscriber: @rjg

Cannot reproduce on Windows either.

Cannot reproduce on Windows either.
Author
Member

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.

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.
Author
Member

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.

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.
Member

Added subscriber: @JacquesLucke

Added subscriber: @JacquesLucke
Member

I assume its some issue with having blender attached to VSC

Maybe @JacquesLucke can reproduce?

In #82552#1051390, @lichtwerk wrote:
Could you provide crash logs?
https://docs.blender.org/manual/en/dev/troubleshooting/crash.html

These could still help

> I assume its some issue with having blender attached to VSC Maybe @JacquesLucke can reproduce? > In #82552#1051390, @lichtwerk wrote: > Could you provide crash logs? > https://docs.blender.org/manual/en/dev/troubleshooting/crash.html These could still help

@DanielGrauer Can you please provide the crash logs?

@DanielGrauer Can you please provide the crash logs?
Author
Member

@rjg there you go blender.crash.txt

@rjg there you go [blender.crash.txt](https://archive.blender.org/developer/F9481624/blender.crash.txt)

@DanielGrauer 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?

@DanielGrauer You seem to be using the Steam version that doesn't have debug symbol. Could you please download a [portable version (*.zip) of Blender ](https://download.blender.org/release/), extract it and repeat the steps?
Author
Member
@rjg [blender.crash.txt](https://archive.blender.org/developer/F9504441/blender.crash.txt)

Changed status from 'Needs User Info' to: 'Needs Developer To Reproduce'

Changed status from 'Needs User Info' to: 'Needs Developer To Reproduce'

Added subscriber: @ideasman42

Added subscriber: @ideasman42

Changed status from 'Needs Developer To Reproduce' to: 'Needs User Info'

Changed status from 'Needs Developer To Reproduce' to: 'Needs User Info'

@DanielGrauer while I can't redo the error, the crash reported happens when setting the exception - which we can avoid.

Can you check if a9dea9cfaa fixes the bug for you?

@DanielGrauer while I can't redo the error, the crash reported happens when setting the exception - which we can avoid. Can you check if a9dea9cfaa fixes the bug for you?
Author
Member

@ideasman42 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.

@ideasman42 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.

@DanielGrauer could you submit a new back-trace? as it should not be crashing in the same place now.

@DanielGrauer could you submit a new back-trace? as it should not be crashing in the same place now.
Author
Member

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.
image.png

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. ![image.png](https://archive.blender.org/developer/F9582359/image.png)

Changed status from 'Needs User Info' to: 'Needs Developer To Reproduce'

Changed status from 'Needs User Info' to: 'Needs Developer To Reproduce'

Changed status from 'Needs Developer To Reproduce' to: 'Needs User Info'

Changed status from 'Needs Developer To Reproduce' to: 'Needs User Info'

@DanielGrauer 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?

@DanielGrauer 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 changed title from back_to_previous() crashes blender to Crash on WIN32 running an operator with context overrides 2021-01-28 06:44:46 +01:00
Author
Member

@ideasman42 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.
Screen Shot 01-30-21 at 02.37 PM.PNG

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.
Screen Shot 01-30-21 at 02.41 PM.PNG

@ideasman42 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. ![Screen Shot 01-30-21 at 02.37 PM.PNG](https://archive.blender.org/developer/F9605310/Screen_Shot_01-30-21_at_02.37_PM.PNG) **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. ![Screen Shot 01-30-21 at 02.41 PM.PNG](https://archive.blender.org/developer/F9605309/Screen_Shot_01-30-21_at_02.41_PM.PNG)

@DanielGrauer Is this still an issue with Python 3.9 in Blender 2.93?

@DanielGrauer Is this still an issue with Python 3.9 in Blender 2.93?
Author
Member

@rjg i just tried with the latest master and it still crashes.

@rjg i just tried with the latest master and it still crashes.
Member

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

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

Changed status from 'Needs Triage' to: 'Archived'

Changed status from 'Needs Triage' to: 'Archived'

@DanielGrauer 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.

@DanielGrauer 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.
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
4 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#82552
No description provided.