Dependency graph update_post handler trigger maximum recursion depth error #65155

Closed
opened 2019-05-26 17:37:05 +02:00 by domlysz · 8 comments

System Information
Operating system: Linux Ubuntu 64bits
Graphics card: /

Blender Version
Broken: Blender 2.8, 2019-05-25
Worked: Blender 2.8, 2019-04-30

Short description of error
When multiple addons append their own depsgraph_update_post handler then it causes a maximum recursion depth error

Exact steps for others to reproduce the error
here a simple code that illustrate the issue

import bpy
from bpy.app.handlers import persistent

@persistent
def scene_update(scn):
    obj = bpy.context.view_layer.objects.active
    if obj is not None:
        print(obj.name)

@persistent
def scene_update2(scn):
    pass
        
bpy.app.handlers.depsgraph_update_post.append(scene_update)
bpy.app.handlers.depsgraph_update_post.append(scene_update2)

This code add a new handler that print the active object's name when the selection change. The code works correctly but if another handlers is appended then clicking on the cube of the default scene print it's name dozens of times and sometimes triggering a maximum recursion depth error. Seems there is no issue when selecting the light or the camera.

**System Information** Operating system: Linux Ubuntu 64bits Graphics card: / **Blender Version** Broken: Blender 2.8, 2019-05-25 Worked: Blender 2.8, 2019-04-30 **Short description of error** When multiple addons append their own *depsgraph_update_post* handler then it causes a maximum recursion depth error **Exact steps for others to reproduce the error** here a simple code that illustrate the issue ``` import bpy from bpy.app.handlers import persistent @persistent def scene_update(scn): obj = bpy.context.view_layer.objects.active if obj is not None: print(obj.name) @persistent def scene_update2(scn): pass bpy.app.handlers.depsgraph_update_post.append(scene_update) bpy.app.handlers.depsgraph_update_post.append(scene_update2) ``` This code add a new handler that print the active object's name when the selection change. The code works correctly but if another handlers is appended then clicking on the cube of the default scene print it's name dozens of times and sometimes triggering a maximum recursion depth error. Seems there is no issue when selecting the light or the camera.
Author

Added subscriber: @domlysz

Added subscriber: @domlysz

Added subscriber: @RossEdwards

Added subscriber: @RossEdwards
Member

Added subscriber: @JacquesLucke

Added subscriber: @JacquesLucke
Member

I cannot reproduce the issue using the given code.

However, in general you should protect yourself against recursions when using these handlers afaik.

I cannot reproduce the issue using the given code. However, in general you should protect yourself against recursions when using these handlers afaik.

Added subscriber: @brecht

Added subscriber: @brecht

I can't reproduce recursion depth errors with this Python script, and it's not clear to me how it could happen here.

What are the exact steps to reproduce this problem? Just run the script and select some objects in the viewport?

I can't reproduce recursion depth errors with this Python script, and it's not clear to me how it could happen here. What are the exact steps to reproduce this problem? Just run the script and select some objects in the viewport?
Author

Thanks for the feeback.

I can confirm that theses steps are not enough to reproduce this error. The initial issue was raised on my own addon's github and concern a conflict with another addon that also use a depsgraph_update_post handler. My addon works correctly as it but raise a recursion depth error only if the other addon is enabled. I'm trying to isolate the issue because I don't undersand what's wrong in my code, but the proposed snipped above fails only if my addon is still enabled.

So, I propose to close this task because for now I can't determine if there is something wrong in my code or in the depsgraph api.

For reference

Thanks for the feeback. I can confirm that theses steps are not enough to reproduce this error. The initial issue was raised on my own addon's github and concern a conflict with another addon that also use a *depsgraph_update_post* handler. My addon works correctly as it but raise a recursion depth error only if the other addon is enabled. I'm trying to isolate the issue because I don't undersand what's wrong in my code, but the proposed snipped above fails only if my addon is still enabled. So, I propose to close this task because for now I can't determine if there is something wrong in my code or in the depsgraph api. For reference - the initial issue : https://github.com/domlysz/BlenderGIS/issues/173 - the handler callback causing the issue : https://github.com/domlysz/BlenderGIS/blob/77ba35311cde4d17dd276d7badc02389bab767a5/operators/nodes_terrain_analysis_reclassify.py#L147

Changed status from 'Open' to: 'Archived'

Changed status from 'Open' to: 'Archived'
Brecht Van Lommel self-assigned this 2019-05-29 11:59:44 +02: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
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#65155
No description provided.