blender crash randomly on animation with link/unlink script #120795

Open
opened 2024-04-18 21:23:49 +02:00 by Eli Spizzichino · 5 comments

System Information
Operating system: Linux Mint 21.2
Graphics card: GTX 3090

Blender Version
Broken: 3.6.11 LTS , 4.0.2, 4.1.0
Worked: none
Short description of error
Blender crash upon rendering the animation or or baking the rigid body world cache

Exact steps for others to reproduce the error

  • Open the demo scene
  • press play to register the script in the text editor
  • Render animation or bake the rigid body world cache

I've asked for help since I can't pinpoint the problem, but it seems happening when I run bpy.data.objects.remove(obj) however the stacktrace randomly point to different part of the python script

**System Information** Operating system: Linux Mint 21.2 Graphics card: GTX 3090 **Blender Version** Broken: 3.6.11 LTS , 4.0.2, 4.1.0 Worked: none **Short description of error** Blender crash upon rendering the animation or or baking the rigid body world cache **Exact steps for others to reproduce the error** - Open the demo scene - press play to register the script in the text editor - Render animation or bake the rigid body world cache I've [asked for help ](https://blender.stackexchange.com/questions/316737/blender-crash-randomly-on-animation-with-link-unlink-script) since I can't pinpoint the problem, but it seems happening when I run `bpy.data.objects.remove(obj)` however the stacktrace randomly point to different part of the python script
Eli Spizzichino added the
Type
Report
Status
Needs Triage
Priority
Normal
labels 2024-04-18 21:23:49 +02:00
Member

Hi, thanks for the report. Can confirm the crash. I guess collection/id is null or pointing to garbage memory when sending depsgraph update.
In debug build I get immediate crash after opening the file due to RigidBodyWorld->group. Maybe this is related to the crash reported here.

Hi, thanks for the report. Can confirm the crash. I guess collection/id is null or pointing to garbage memory when sending depsgraph update. In debug build I get immediate crash after opening the file due to `RigidBodyWorld->group`. Maybe this is related to the crash reported here.
Member

First note: modifying data in frame_change handlers can be problematic, #117386 #88726 #117386 might be related

First note: modifying data in frame_change handlers can be problematic, #117386 #88726 #117386 might be related

I've realized that even baking the simulation make blender crash after some frames!

So at this point I'm stuck, I wanted to use Blender to produce synthetic images with a basic rigid body simulation, but if I can't modify the scene or bake it, I can't use Blender at all! (particle physics doesn't support self collision)

I've realized that even baking the simulation make blender crash after some frames! So at this point I'm stuck, I wanted to use Blender to produce synthetic images with a basic rigid body simulation, but if I can't modify the scene or bake it, I can't use Blender at all! (particle physics doesn't support self collision)
Member

OK, so first of all I think we can confirm the crash for now.

Like I said, modifying data in handlers can be problematic, maybe @Sergey knows more already?

OK, so first of all I think we can confirm the crash for now. Like I said, modifying data in handlers can be problematic, maybe @Sergey knows more already?

In a way the handlers are there to allow data modifications, so it is a bit annoying situation when we have a system in-place, but we know its use-case is problematic. Like, what's the point of this system then. We should make it work, somehow. And somehow make its limitations more obvious.

I don't have a quick solution in-mind, just more like ideas after a quick look. Generally, we somehow need to improve thread-safety.

For the baking operator there are a couple of things we can do:

  • Skip outliner redraws when CTX_wm_interface_locked() is true
  • Skip poll of operators and keymaps which are not flagged OPTYPE_LOCK_BYPASS. Currently we only do it for exec/invoke, but poll can do unsafe things as well. This seems easy to do for operators, but keymaps I am not sure, as we do not have this lock-bypass concept for them.

For the rendering I am not fully sure what's going on. I thought we already run depsgraph evaluation from a state which does not cause threading conflict with the UI. So not sure what is going on there.

In a way the handlers are there to allow data modifications, so it is a bit annoying situation when we have a system in-place, but we know its use-case is problematic. Like, what's the point of this system then. We should make it work, somehow. And somehow make its limitations more obvious. I don't have a quick solution in-mind, just more like ideas after a quick look. Generally, we somehow need to improve thread-safety. For the baking operator there are a couple of things we can do: - Skip outliner redraws when `CTX_wm_interface_locked()` is `true` - Skip `poll` of operators and keymaps which are not flagged `OPTYPE_LOCK_BYPASS`. Currently we only do it for exec/invoke, but poll can do unsafe things as well. This seems easy to do for operators, but keymaps I am not sure, as we do not have this lock-bypass concept for them. For the rendering I am not fully sure what's going on. I thought we already run depsgraph evaluation from a state which does not cause threading conflict with the UI. So not sure what is going on there.
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#120795
No description provided.