Zen UV 5.4.1 causes a stack overflow when rotating...
# zenuv-support
s
**Environment: **Windows 10, Blender 5.2.3 LTS, Zen UV 5.4.1, and Physical Starlight and Atmosphere (PSA) 1.9.6. Reproduced with both Vulkan and OpenGL in Solid viewport mode. Steps to reproduce 1. Enable Zen UV and PSA in Blender’s default scene. 2. Add the PSA atmosphere. 3. In the PSA Sun panel, change Rotation → Vertical from approximately −87.035° to −86°. Expected behavior: The sun and atmosphere update, and Blender remains responsive. Actual behavior: Blender exits with EXCEPTION_STACK_OVERFLOW immediately after the value changes. Dragging the field, typing a single value, and setting the sun’s X rotation through Python all reproduced the crash. PSA alone and Zen UV with a standard Blender Sun lamp both passed the same rotation test. Cause and proposed fix In ZenUV/ui/gizmo_draw.py, the zenuv_depsgraph_ui_update callback calls bpy.context.evaluated_depsgraph_get() from inside a depsgraph_update_post handler. When PSA updates the sun and atmosphere during the same dependency graph update, that call can trigger another evaluation. Instrumentation confirmed that the Zen UV callback was re-entered recursively before its previous invocation returned. Use the dependency graph Blender passes to the handler. Change the callback signature to def zenuv_depsgraph_ui_update(scene, depsgraph):, remove the call to bpy.context.evaluated_depsgraph_get(), and use the supplied depsgraph for the existing depsgraph.updates loop. I tested this change in an isolated copy of Zen UV with unmodified PSA 1.9.6. All six consecutive sun rotation changes completed successfully.
a
Hi, this happens because PSA modify scene inside of depsgraph_update handler. There were previous reports of such an issue and we explained detaily to the PSA developers the reason. So, first of all update to the latest PSA, hope they fixed the problem
s
I was leaning toward Zen UV at first because that’s where I saw the callback looping. Moving PSA’s sun updates out of the depsgraph handler stopped the crash with Zen UV unchanged, so I agree PSA is the first place to fix it. I still think there’s a good reason to make the change in Zen UV too. Blender already passes the graph being updated to the callback, and Zen UV only needs it to read depsgraph.updates. Calling evaluated_depsgraph_get() there can start another evaluation if an add-on has just changed scene data. That can run the same callback again before the first call finishes. Using the graph Blender already passed avoids that route back into the callback, even if another add-on does something similar. I tried that change on its own with stock PSA 1.9.6, and the crash stopped. I’m already on PSA 1.9.6, which is the latest version.
a
Did you understand the problem? PSA must not change anything in depsgraph_update, they should put it in a queue, because change of scene inside calls new depsgaph_update, which lead to a recustion
https://blenderartists.org/t/machin3tools/1135716/1211?u=alexander_zhornyak Here is my detailed explanation for another addon (Machine3). The addon developer accepted my proposal and we are successfully existing with each other
If PSA developers do not want to change anything there are 2 solutions for you: 1. PSA must be after ZenUV in the list of addons (1. Uninstall PSA, 2. Restart Blender. 3. Install PSA) 2. Disable depsgraph_update in ZenUV by disabling Auto Update Draw option https://cdn.discordapp.com/attachments/1578191849297018921/1578328298923102338/image.png?ex=6b13cc46&is=6b127ac6&hm=a101066ce68223026b27104c39d1fa5f64fdc871812587746d4ec293ea7c1002&
Regarding your proposal to remove evaluated_get - this will not help
If someone changes scene inside a depsgraph handler, it will still call endless handlers from other addons
s
okay thank you, I also talked with the PSA devs, they will handle it.