Crash! Calling a modal operator from a load_post handler causes a segmentation fault #92258

Closed
opened 2021-10-16 04:23:47 +02:00 by Jeducious · 13 comments

System Information
Operating system:MacOS
Graphics card:intel iris graphics
system-info.txt

Blender Version
Broken: 3.0 alpha, 2055ef107a, master, 2021-10-14
Worked: Blender 2.93.4

Short description of error
Our addon Crowdrender uses the bpy.apps.handlers.load_post handler to trigger a modal operator. On Blender 2.93 and below, this has worked since 2.80/2.79. However, in the latest alpha versions of Blender 3.0 this now causes a crash when Blender starts.

If the addon is disabled at startup, however, the crash is avoided and the addon can be enabled successfully without a crash once Blender has started. I can also load a new file and Blender remains stable and running. The problem seems to only occur at startup.

The crash report is here -> Mac crash report.rtf

Exact steps for others to reproduce the error
The scene used is irrelevant since Blender is crashing before the user is able to access the UI.

Please find attached a small addon that reproduces the same issue.
load_post_handler_crash.py
To reproduce the problem,

  • copy the addon to Blender's addons folder
  • make sure this addon is enabled in Blender's preferences
  • then save the preferences to make the addon load when Blender starts
  • restart Blender

Blender crashes on startup

**System Information** Operating system:MacOS Graphics card:intel iris graphics [system-info.txt](https://archive.blender.org/developer/F11157101/system-info.txt) **Blender Version** Broken: 3.0 alpha, 2055ef107a7c, master, 2021-10-14 Worked: Blender 2.93.4 **Short description of error** Our addon [Crowdrender ](https://www.crowd-render.com) uses the bpy.apps.handlers.load_post handler to trigger a modal operator. On Blender 2.93 and below, this has worked since 2.80/2.79. However, in the latest alpha versions of Blender 3.0 this now causes a crash when Blender starts. If the addon is disabled at startup, however, the crash is avoided and the addon can be enabled successfully without a crash once Blender has started. I can also load a new file and Blender remains stable and running. The problem seems to only occur at startup. The crash report is here -> [Mac crash report.rtf](https://archive.blender.org/developer/F11157189/Mac_crash_report.rtf) **Exact steps for others to reproduce the error** The scene used is irrelevant since Blender is crashing before the user is able to access the UI. Please find attached a small addon that reproduces the same issue. [load_post_handler_crash.py](https://archive.blender.org/developer/F11173310/load_post_handler_crash.py) To reproduce the problem, - copy the addon to Blender's addons folder - make sure this addon is enabled in Blender's preferences - then save the preferences to make the addon load when Blender starts - restart Blender # Blender crashes on startup
Author

Added subscriber: @JamesCrowther

Added subscriber: @JamesCrowther
Member

Added subscriber: @Imaginer

Added subscriber: @Imaginer

Added subscriber: @erik85

Added subscriber: @erik85

I tried this on Win10 but can't reproduce the crash. I also had to modify the script with from bpy.app.handlers import persistent and @persistent decorator on the handler function to make it run.

I tried this on Win10 but can't reproduce the crash. I also had to modify the script with `from bpy.app.handlers import persistent` and `@persistent` decorator on the handler function to make it run.
Author

In #92258#1236621, @erik85 wrote:
I tried this on Win10 but can't reproduce the crash. I also had to modify the script with from bpy.app.handlers import persistent and @persistent decorator on the handler function to make it run.

Yeah, I am on macOS, haven't tried this on win10 yet. Copy that on the need to add the persistent decorator. Not sure why its not in the code I attached, its in my local copy. Could have been I uploaded an older version. Sorry about that :S

> In #92258#1236621, @erik85 wrote: > I tried this on Win10 but can't reproduce the crash. I also had to modify the script with `from bpy.app.handlers import persistent` and `@persistent` decorator on the handler function to make it run. Yeah, I am on macOS, haven't tried this on win10 yet. Copy that on the need to add the persistent decorator. Not sure why its not in the code I attached, its in my local copy. Could have been I uploaded an older version. Sorry about that :S
Author

Just updated the attached addon so it has the @persistent decorator. Looks like I moved the file when I was testing it with Blender 3.0.0 and then uploaded the copy from the old location. I have edited the task above and replaced the addon with the one I was able to reproduce the same crash with.

Just updated the attached addon so it has the @persistent decorator. Looks like I moved the file when I was testing it with Blender 3.0.0 and then uploaded the copy from the old location. I have edited the task above and replaced the addon with the one I was able to reproduce the same crash with.
Member

Added subscriber: @PratikPB2123

Added subscriber: @PratikPB2123
Member

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

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

Can not reproduce either, tested on current master and 3.0.0(2055ef107a)
Does this still occur for you on latest builds?: https://builder.blender.org/download/daily/
May be you could also add userprefs.blend file to test the crash

Can not reproduce either, tested on current master and 3.0.0(2055ef107a) Does this still occur for you on latest builds?: https://builder.blender.org/download/daily/ May be you could also add `userprefs.blend` file to test the crash
Member

Added subscriber: @mano-wii

Added subscriber: @mano-wii
Member

@mano-wii , can you reproduce? Otherwise we can close the task as report went cold for more than a week

@mano-wii , can you reproduce? Otherwise we can close the task as report went cold for more than a week

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

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

I cannot reproduce the problem.
The operator runs normally and intermittently (which is not a good practice as, among other things, it makes Auto Save impossible).


System Information
Operating system: macOS-12.2-arm64-arm-64bit 64 Bits
Graphics card: Apple M1 Apple 4.1 Metal - 76.3

I cannot reproduce the problem. The operator runs normally and intermittently (which is not a good practice as, among other things, it makes Auto Save impossible). --- **System Information** Operating system: `macOS-12.2-arm64-arm-64bit 64 Bits` Graphics card: `Apple M1 Apple 4.1 Metal - 76.3`
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
5 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#92258
No description provided.