Blender may crash with RecursionError when deleting multiple objects/armatures (race condition) #431
Labels
No labels
Added
Avatar Toolkit Idea (Won't be added to Cats)
Cleanup
Fixed
Further Info Needed
In Progress
Might Add
Release Candidate
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Kneelawk/Cats-Blender-Plugin#431
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description
Blender 5.0 crashes with a
RecursionErrorwhen deleting multiple objects containing armatures. The crash does not occur when the plugin is disabled.Crash is preceded by:
Then hundreds of stack frames:
Full crash log: https://gist.github.com/lazulit3/2f89729ba0f3f3d5ebc849016166265a
Blender Version
CATS Version
Operating System
Steps to Reproduce
Note: This bug is difficult to reproduce in synthetic test cases but consistently occurs in a real VRChat avatar project that I'm working with.
Confirmed Reproduction
Consistently reproducible with Skip4D's Chibi Base Avatar (Deluxe). Unfortunately I cannot share files for reproducing this, as I cannot redistribute their work. But I'm happy to help test iterations of a fix if that's helpful.
Attempted Minimal Test Case (Unsuccessful)
I attempted to create a minimal reproducible test case:
Despite matching the structure of real projects where the crash occurs, this synthetic test case did not trigger the bug. The crash appears to require specific conditions present in real-world avatar projects that are difficult to isolate, suggesting a race condition.
Root Cause
The Blender 5.0 enum compatibility code has infinite recursion in
tools/common.py:bpy.context.view_layer.objectsis modifiedcontext.scene.armatureEnumPropertywrapped_items_func()detects out-of-bounds value_schedule_enum_fix()attempts directsetattr()(line 2343)wrapped_items_func()againProblematic code:
Proposed Solution
Primary Fix (Option 1): Remove direct
setattr()and always use timer-based updates:Defense-in-Depth (Option 2): Add recursion guard to
wrapped_items_func():Additional Context
3e1af6bpartially fixed enum handling but left the problematicsetattr()Related Files
tools/common.py: Lines 2339, 2392, 2248extentions.py: Line 57References
This is a good first issue, i will review you PR fully later however it does seem like it's a good fix.
You fix has been merged into the dev branch, it had been marked for the 5.0.2.1 release which will be released on Friday, thanks for your contribution.