Crash when creating geometry nodes in a for-loop with Python #100872

Closed
opened 2022-09-07 10:28:29 +02:00 by Jani Kahrama · 17 comments

System Information
Operating system: Windows-10-10.0.19044-SP0 64 Bits
Graphics card: NVIDIA GeForce RTX 3090/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 516.94

Blender Version
Broken: version: 3.3.0 Release Candidate, branch: master, commit date: 2022-09-05 13:20, hash: 8000d52684
Worked: version: 3.2.2

Short description of error
Creating a node network with a python script that contains a for-loop crashes 3.3.0 with an EXCEPTION_ACCESS_VIOLATION.
Same script works in 3.2.2 and creates multiple nodes without issue.

If the offending code is removed from inside the for-loop and run directly, no crash happens.

Exact steps for others to reproduce the error
Just start Blender 3.3.0, go to scripting view, paste the attached example script, run it, observe the crash.

mini_tiler_example.py

**System Information** Operating system: Windows-10-10.0.19044-SP0 64 Bits Graphics card: NVIDIA GeForce RTX 3090/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 516.94 **Blender Version** Broken: version: 3.3.0 Release Candidate, branch: master, commit date: 2022-09-05 13:20, hash: `8000d52684` Worked: version: 3.2.2 **Short description of error** Creating a node network with a python script that contains a for-loop crashes 3.3.0 with an EXCEPTION_ACCESS_VIOLATION. Same script works in 3.2.2 and creates multiple nodes without issue. If the offending code is removed from inside the for-loop and run directly, no crash happens. **Exact steps for others to reproduce the error** Just start Blender 3.3.0, go to scripting view, paste the attached example script, run it, observe the crash. [mini_tiler_example.py](https://archive.blender.org/developer/F13464373/mini_tiler_example.py)
Author

Added subscriber: @Frand

Added subscriber: @Frand

#101590 was marked as duplicate of this issue

#101590 was marked as duplicate of this issue

Added subscriber: @mano-wii

Added subscriber: @mano-wii

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

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

I can confirm the problem.
It seems to have been induced sometime between d095fcd6b4 and 8589f60546
I've tried bisect in Debug Build but no success.
I'll try again another time.

I saw an assert that seems to be related.
BLI_assert failed: C:\BlenderDev\blender\source\blender\blenlib\BLI_vector.hh:299, operator - [ ](), at 'index < this->size()'

I can confirm the problem. It seems to have been induced sometime between d095fcd6b417 and 8589f60546b3 I've tried bisect in Debug Build but no success. I'll try again another time. I saw an assert that seems to be related. `BLI_assert failed: C:\BlenderDev\blender\source\blender\blenlib\BLI_vector.hh:299, operator - [ ](), at 'index < this->size()'`
Member

Added subscriber: @HooglyBoogly

Added subscriber: @HooglyBoogly
Member

Thanks for the report. Seems an assert is failing in determine_group_input_states.

Thanks for the report. Seems an assert is failing in `determine_group_input_states`.
Author

Is there a workaround for the time being? Can the node network be manually refreshed after an input has been adeed to avoid the crash?

Is there a workaround for the time being? Can the node network be manually refreshed after an input has been adeed to avoid the crash?
Member

Added subscriber: @JacquesLucke

Added subscriber: @JacquesLucke
Member

From briefly looking at the code it seems like the fundamental issue is the same as in #100770.
Are you trying to add node group inputs/outputs by linking to them in code?
To add group inputs/outputs, please add them to the node tree directly (node_tree.inputs.new). Does that solve it for you?

From briefly looking at the code it seems like the fundamental issue is the same as in #100770. Are you trying to add node group inputs/outputs by linking to them in code? To add group inputs/outputs, please add them to the node tree directly (`node_tree.inputs.new`). Does that solve it for you?
Author

Thank you, yes, adding group input directly to node_tree appears to be the needed workaround! No crash in 3.3 with this approach.

Thank you, yes, adding group input directly to node_tree appears to be the needed workaround! No crash in 3.3 with this approach.

Added subscribers: @Khemadeva, @mod_moder

Added subscribers: @Khemadeva, @mod_moder

Removed subscribers: @mod_moder, @Khemadeva

Removed subscribers: @mod_moder, @Khemadeva
Member

Added subscriber: @LukasTonne

Added subscriber: @LukasTonne
Member

More generally: it is currently possible to add or remove sockets from any node through the python API, not just group nodes. This is not ideal because usually the renderer, geonodes, compositor, etc. expect the sockets to match a certain layout. In the case of group nodes the layout is defined by the tree data block, which is the correct way to change node groups (as mentioned by others). We could try to disable this but it might cause issues with existing scripts. At least for custom python nodes it should remain allowed.

EDIT: Jacques' patch does exactly this, should be good.

More generally: it is currently possible to add or remove sockets from *any* node through the python API, not just group nodes. This is not ideal because usually the renderer, geonodes, compositor, etc. expect the sockets to match a certain layout. In the case of group nodes the layout is defined by the tree data block, which is the correct way to change node groups (as mentioned by others). We could try to disable this but it might cause issues with existing scripts. At least for custom python nodes it should remain allowed. EDIT: Jacques' patch does exactly this, should be good.

This issue was referenced by 52bd198153

This issue was referenced by 52bd198153ede3c7131df895bb08e4828aab1e9b
Member

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Jacques Lucke self-assigned this 2022-11-07 14:44:10 +01:00
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
6 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#100872
No description provided.