Python API: segmentation fault on UNDO after duplicating objects from Application timer #80759

Closed
opened 2020-09-14 00:51:49 +02:00 by Jean Da Costa · 10 comments

System Information
Operating system: Linux-5.4.0-47-generic-x86_64-with-debian-bullseye-sid 64 Bits
Graphics card: Radeon RX 570 Series ATI Technologies Inc. 4.5.14752 Core Profile Context 20.30

Blender Version
Broken: version: 2.90.0, branch: master, commit date: 2020-08-31 11:26, hash: 0330d1af29
Worked: (newest version of Blender that worked as expected)

Short description of error
segmentation fault when duplicating objects using modal operator.
It doesn't happen using the legacy undo option.

Exact steps for others to reproduce the error

  • open the default cube scene, split the viewport ans switch to the text editor.

  • load the "Operator modal timer " example template.

  • add the following line at the end of the modal function: bpy.ops.object.duplicate()

  • run the script for a very few seconds and press ESC to stop it.

  • press Ctrl + Z in the viewport.

  • segfault

blender.crash.txt

**System Information** Operating system: Linux-5.4.0-47-generic-x86_64-with-debian-bullseye-sid 64 Bits Graphics card: Radeon RX 570 Series ATI Technologies Inc. 4.5.14752 Core Profile Context 20.30 **Blender Version** Broken: version: 2.90.0, branch: master, commit date: 2020-08-31 11:26, hash: `0330d1af29` Worked: (newest version of Blender that worked as expected) **Short description of error** segmentation fault when duplicating objects using modal operator. It doesn't happen using the legacy undo option. **Exact steps for others to reproduce the error** * open the default cube scene, split the viewport ans switch to the text editor. * load the "Operator modal timer " example template. * add the following line at the end of the modal function: `bpy.ops.object.duplicate()` * run the script for a very few seconds and press ESC to stop it. * press Ctrl + Z in the viewport. * segfault [blender.crash.txt](https://archive.blender.org/developer/F8874985/blender.crash.txt)
Author

Added subscriber: @jeacom

Added subscriber: @jeacom
Member

Added subscriber: @lichtwerk

Added subscriber: @lichtwerk
Member

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

Changed status from 'Needs Triage' to: 'Confirmed'
Member

Can confirm.

Base has a NULL object here.

1   BKE_scene_object_base_flag_sync_from_base scene.c           1780 0x33b6a96 
2   BKE_scene_set_background                  scene.c           991  0x33b5244 
3   setup_app_data                            blendfile.c       382  0x4536c36 
4   setup_app_blend_file_data                 blendfile.c       412  0x4536cca 
5   BKE_blendfile_read_from_memfile           blendfile.c       510  0x4537096 
6   BKE_memfile_undo_decode                   blender_undo.c    87   0x4535fb6 
7   memfile_undosys_step_decode               memfile_undo.c    190  0x426e3c7 
8   undosys_step_decode                       undo_system.c     210  0x456fd8f 
9   BKE_undosys_step_undo_with_data_ex        undo_system.c     693  0x457145b 
10  BKE_undosys_step_undo_with_data           undo_system.c     722  0x45715bb 
11  BKE_undosys_step_undo                     undo_system.c     727  0x45715e8 
12  ed_undo_step_impl                         ed_undo.c         207  0x426c319 
13  ed_undo_step_direction                    ed_undo.c         271  0x426c60a 
14  ed_undo_exec                              ed_undo.c         407  0x426cabe 
15  wm_operator_invoke                        wm_event_system.c 1313 0x36b3a92 
16  wm_handler_operator_call                  wm_event_system.c 2132 0x36b57f4 
17  wm_handlers_do_keymap_with_keymap_handler wm_event_system.c 2442 0x36b64c3 
18  wm_handlers_do_intern                     wm_event_system.c 2739 0x36b7413 
19  wm_handlers_do                            wm_event_system.c 2866 0x36b78d7 
20  wm_event_do_handlers                      wm_event_system.c 3399 0x36b903f 

Think this is very much related to #62074 (2.8: Python API: crash due to missing window context in Application timer) and #62051 (2.8: Python API: bpy.context.object not available in Application Timers) though

Can confirm. Base has a NULL object here. ``` 1 BKE_scene_object_base_flag_sync_from_base scene.c 1780 0x33b6a96 2 BKE_scene_set_background scene.c 991 0x33b5244 3 setup_app_data blendfile.c 382 0x4536c36 4 setup_app_blend_file_data blendfile.c 412 0x4536cca 5 BKE_blendfile_read_from_memfile blendfile.c 510 0x4537096 6 BKE_memfile_undo_decode blender_undo.c 87 0x4535fb6 7 memfile_undosys_step_decode memfile_undo.c 190 0x426e3c7 8 undosys_step_decode undo_system.c 210 0x456fd8f 9 BKE_undosys_step_undo_with_data_ex undo_system.c 693 0x457145b 10 BKE_undosys_step_undo_with_data undo_system.c 722 0x45715bb 11 BKE_undosys_step_undo undo_system.c 727 0x45715e8 12 ed_undo_step_impl ed_undo.c 207 0x426c319 13 ed_undo_step_direction ed_undo.c 271 0x426c60a 14 ed_undo_exec ed_undo.c 407 0x426cabe 15 wm_operator_invoke wm_event_system.c 1313 0x36b3a92 16 wm_handler_operator_call wm_event_system.c 2132 0x36b57f4 17 wm_handlers_do_keymap_with_keymap_handler wm_event_system.c 2442 0x36b64c3 18 wm_handlers_do_intern wm_event_system.c 2739 0x36b7413 19 wm_handlers_do wm_event_system.c 2866 0x36b78d7 20 wm_event_do_handlers wm_event_system.c 3399 0x36b903f ``` Think this is very much related to #62074 (2.8: Python API: crash due to missing window context in Application timer) and #62051 (2.8: Python API: bpy.context.object not available in Application Timers) though
Philipp Oeser changed title from segmentation fault when duplicating objects using modal operator. to Python API: segmentation fault on UNDO after duplicating objects from Application timer 2020-09-14 12:28:24 +02:00

Added subscriber: @ideasman42

Added subscriber: @ideasman42

Note that I think we could even consider disabling operator execution from timers, this seems to cause a lot of bugs since operators aren't written to run outside the main event loop where the context is setup and events are being properly handled.

Note that I think we could even consider disabling operator execution from timers, this seems to cause a lot of bugs since operators aren't written to run outside the main event loop where the context is setup and events are being properly handled.
Author

In #80759#1015761, @ideasman42 wrote:
Note that I think we could even consider disabling operator execution from timers, this seems to cause a lot of bugs since operators aren't written to run outside the main event loop where the context is setup and events are being properly handled.

I'm afraid this would break so many add-ons that rely on an event timer to implement interactivity and use operators to its functionality.

also, the same issue happens for modal operators that dont have a timer, and also happens if the user triggered the operator while another modal operator is running, regardless of if it has a timer.

> In #80759#1015761, @ideasman42 wrote: > Note that I think we could even consider disabling operator execution from timers, this seems to cause a lot of bugs since operators aren't written to run outside the main event loop where the context is setup and events are being properly handled. I'm afraid this would break so many add-ons that rely on an event timer to implement interactivity and use operators to its functionality. also, the same issue happens for modal operators that dont have a timer, and also happens if the user triggered the operator while another modal operator is running, regardless of if it has a timer.

Checking the test file, I was under the impression this was for bpy.app.timers, not modal operators.

Checking the test file, I was under the impression this was for `bpy.app.timers`, not modal operators.

Closed as duplicate of #77557

Closed as duplicate of #77557

Added subscriber: @pauanyu_blender

Added subscriber: @pauanyu_blender
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#80759
No description provided.