Regression: Crash when accessing animated 'object.data' property in a driver of a Mesh #96289

Closed
opened 2022-03-10 09:50:39 +01:00 by naoki yamamoto · 23 comments

System Information
Operating system: Windows-10-10.0.19043-SP0 64 Bits
Graphics card: NVIDIA GeForce RTX 2080 Ti/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 511.65
blender_system_info.txt

Blender Version
Broken: version: 3.1.0, branch: master, commit date: 2022-03-08 18:16, hash: c77597cd0e
Worked: version: 3.1.0 Alpha, branch: master, commit date: 2022-01-23 19:27, hash: abf30007ab

Apparently, this is caused by 56407432a6

Short description of error
Drivers accessing properties of other Meshes may crash.
This was noticed when performing F12 render or spacebar animation on certain models
As far as I can tell, more than half of the models I have checked do not allow most operations (I suspect my models are biased).
No problem in 3.0. All daily builds are unconfirmed, but 3.1.0 Alpha, branch: master, commit date: 2022-01-23 19:27 was the latest I checked that works.

Crash Log:
qulle-3.1test.crash.txt

Exact steps for others to reproduce the error

  • Open the blend file attached or
    • Create 2 objects each one with shapekeys (Object A and Object B)
    • Add keyframes to the value of a shapekey of Object A
    • In the value of the shapekey of Object B add a driver accessing the shapekey of Object A - (data.shape_keys.key_blocks["Key 1"].value)
  • Space bar to animation start - crash

Simplified file:
drivers_crash-simplied_only_one_shapekey.blend


Original file:
qulle-3.1test.blend

**System Information** Operating system: Windows-10-10.0.19043-SP0 64 Bits Graphics card: NVIDIA GeForce RTX 2080 Ti/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 511.65 [blender_system_info.txt](https://archive.blender.org/developer/F12919026/blender_system_info.txt) **Blender Version** Broken: version: 3.1.0, branch: master, commit date: 2022-03-08 18:16, hash: `c77597cd0e` Worked: version: 3.1.0 Alpha, branch: master, commit date: 2022-01-23 19:27, hash: `abf30007ab` Apparently, this is caused by 56407432a6 **Short description of error** Drivers accessing properties of other Meshes may crash. This was noticed when performing F12 render or spacebar animation on certain models As far as I can tell, more than half of the models I have checked do not allow most operations (I suspect my models are biased). No problem in 3.0. All daily builds are unconfirmed, but 3.1.0 Alpha, branch: master, commit date: 2022-01-23 19:27 was the latest I checked that works. Crash Log: [qulle-3.1test.crash.txt](https://archive.blender.org/developer/F12919028/qulle-3.1test.crash.txt) **Exact steps for others to reproduce the error** - Open the blend file attached or - Create 2 objects each one with shapekeys (Object A and Object B) - Add keyframes to the value of a shapekey of Object A - In the value of the shapekey of Object B add a driver accessing the shapekey of Object A - (`data.shape_keys.key_blocks["Key 1"].value`) - Space bar to animation start - crash Simplified file: [drivers_crash-simplied_only_one_shapekey.blend](https://archive.blender.org/developer/F12920627/drivers_crash-simplied_only_one_shapekey.blend) --- Original file: [qulle-3.1test.blend](https://archive.blender.org/developer/F12919033/qulle-3.1test.blend)
Author

Added subscriber: @poopoo

Added subscriber: @poopoo

#97710 was marked as duplicate of this issue

#97710 was marked as duplicate of this issue
naoki yamamoto changed title from Crash when performing F12 render or spacebar animation on certain models to Crash when performing F12 render or spacebar animation on certain models in 3.1 2022-03-10 10:09:50 +01:00
Member

Added subscriber: @PratikPB2123

Added subscriber: @PratikPB2123

Added subscriber: @mano-wii

Added subscriber: @mano-wii

I can confirm the crash. It happens inside some driver.

 	blender.exe!pthread_mutex_lock()	C
>	blender.exe!BKE_mesh_wrapper_ensure_subdivision(const Object * ob, Mesh * me) Line 384	C

 	blender.exe!rna_Object_data_get(PointerRNA * ptr) Line 521	C
 	blender.exe!Object_data_get(PointerRNA * ptr) Line 505	C
 	blender.exe!RNA_property_pointer_get(PointerRNA * ptr, PropertyRNA * prop) Line 3485	C
 	blender.exe!rna_path_parse(PointerRNA * ptr, const unsigned char * path, PointerRNA * r_ptr, PropertyRNA * * r_prop, int * r_index, PointerRNA * r_item_ptr, ListBase * r_elements, const bool eval_pointer) Line 5183	C
 	blender.exe!RNA_path_resolve_property_full(PointerRNA * ptr, const unsigned char * path, PointerRNA * r_ptr, PropertyRNA * * r_prop, int * r_index) Line 5290	C
 	blender.exe!dtar_get_prop_val(ChannelDriver * driver, DriverTarget * dtar) Line 109	C
 	blender.exe!driver_get_variable_value(ChannelDriver * driver, DriverVar * dvar) Line 1144	C
 	blender.exe!driver_evaluate_simple_expr(ChannelDriver * driver, ExprPyLike_Parsed * expr, float * result, float time) Line 987	C
 	blender.exe!driver_try_evaluate_simple_expr(ChannelDriver * driver, ChannelDriver * driver_orig, float * result, float time) Line 1051	C
 	blender.exe!evaluate_driver_python(PathResolvedRNA * anim_rna, ChannelDriver * driver, ChannelDriver * driver_orig, const AnimationEvalContext * anim_eval_context) Line 1223	C
 	blender.exe!evaluate_driver(PathResolvedRNA * anim_rna, ChannelDriver * driver, ChannelDriver * driver_orig, const AnimationEvalContext * anim_eval_context) Line 1269	C
 	blender.exe!evaluate_fcurve_driver(PathResolvedRNA * anim_rna, FCurve * fcu, ChannelDriver * driver_orig, const AnimationEvalContext * anim_eval_context) Line 2102	C
 	blender.exe!calculate_fcurve(PathResolvedRNA * anim_rna, FCurve * fcu, const AnimationEvalContext * anim_eval_context) Line 2154	C
 	blender.exe!BKE_animsys_eval_driver(Depsgraph * depsgraph, ID * id, int driver_index, FCurve * fcu_orig) Line 3489	C
 	[Inline Frame] blender.exe!std::_Func_class<void,Depsgraph *>::operator()(Depsgraph * <_Args_0>) Line 880	C++
 	blender.exe!blender::deg::`anonymous namespace'::evaluate_node(const blender::deg::`anonymous-namespace'::DepsgraphEvalState * state, blender::deg::OperationNode * operation_node) Line 104	C++
 	blender.exe!blender::deg::`anonymous namespace'::deg_task_run_func(TaskPool * pool, void * taskdata) Line 116	C++
 	blender.exe!tbb::internal::function_task<Task>::execute() Line 1060	C++
 	[External Code]	

But the .blend file is too complex. It needs to be simplified before we confirm and forward it to the developers.

I can confirm the crash. It happens inside some driver. ```lines=10 blender.exe!pthread_mutex_lock() C > blender.exe!BKE_mesh_wrapper_ensure_subdivision(const Object * ob, Mesh * me) Line 384 C blender.exe!rna_Object_data_get(PointerRNA * ptr) Line 521 C blender.exe!Object_data_get(PointerRNA * ptr) Line 505 C blender.exe!RNA_property_pointer_get(PointerRNA * ptr, PropertyRNA * prop) Line 3485 C blender.exe!rna_path_parse(PointerRNA * ptr, const unsigned char * path, PointerRNA * r_ptr, PropertyRNA * * r_prop, int * r_index, PointerRNA * r_item_ptr, ListBase * r_elements, const bool eval_pointer) Line 5183 C blender.exe!RNA_path_resolve_property_full(PointerRNA * ptr, const unsigned char * path, PointerRNA * r_ptr, PropertyRNA * * r_prop, int * r_index) Line 5290 C blender.exe!dtar_get_prop_val(ChannelDriver * driver, DriverTarget * dtar) Line 109 C blender.exe!driver_get_variable_value(ChannelDriver * driver, DriverVar * dvar) Line 1144 C blender.exe!driver_evaluate_simple_expr(ChannelDriver * driver, ExprPyLike_Parsed * expr, float * result, float time) Line 987 C blender.exe!driver_try_evaluate_simple_expr(ChannelDriver * driver, ChannelDriver * driver_orig, float * result, float time) Line 1051 C blender.exe!evaluate_driver_python(PathResolvedRNA * anim_rna, ChannelDriver * driver, ChannelDriver * driver_orig, const AnimationEvalContext * anim_eval_context) Line 1223 C blender.exe!evaluate_driver(PathResolvedRNA * anim_rna, ChannelDriver * driver, ChannelDriver * driver_orig, const AnimationEvalContext * anim_eval_context) Line 1269 C blender.exe!evaluate_fcurve_driver(PathResolvedRNA * anim_rna, FCurve * fcu, ChannelDriver * driver_orig, const AnimationEvalContext * anim_eval_context) Line 2102 C blender.exe!calculate_fcurve(PathResolvedRNA * anim_rna, FCurve * fcu, const AnimationEvalContext * anim_eval_context) Line 2154 C blender.exe!BKE_animsys_eval_driver(Depsgraph * depsgraph, ID * id, int driver_index, FCurve * fcu_orig) Line 3489 C [Inline Frame] blender.exe!std::_Func_class<void,Depsgraph *>::operator()(Depsgraph * <_Args_0>) Line 880 C++ blender.exe!blender::deg::`anonymous namespace'::evaluate_node(const blender::deg::`anonymous-namespace'::DepsgraphEvalState * state, blender::deg::OperationNode * operation_node) Line 104 C++ blender.exe!blender::deg::`anonymous namespace'::deg_task_run_func(TaskPool * pool, void * taskdata) Line 116 C++ blender.exe!tbb::internal::function_task<Task>::execute() Line 1060 C++ [External Code] ``` But the .blend file is too complex. It needs to be simplified before we confirm and forward it to the developers.

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

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

I was able to simplify the file but I couldn't do a bisect to find the causing commit, because the behavior changes between Debug and RelWithDebInfo and many of the commits had to be skipped due to the error:
LNK1201 error writing to program database 'D:\Dev\BlenderDev\x64-Debug\source\creator\Debug\tf.pdb'; check for insufficient disk space, invalid path, or insufficient privilege blender D:\Dev\BlenderDev\x64-Debug\source\creator\LINK 1

I've spent a long time trying to bisect without success.
drivers_crash.blend

I was able to simplify the file but I couldn't do a bisect to find the causing commit, because the behavior changes between Debug and RelWithDebInfo and many of the commits had to be skipped due to the error: `LNK1201 error writing to program database 'D:\Dev\BlenderDev\x64-Debug\source\creator\Debug\tf.pdb'; check for insufficient disk space, invalid path, or insufficient privilege blender D:\Dev\BlenderDev\x64-Debug\source\creator\LINK 1 ` I've spent a long time trying to bisect without success. [drivers_crash.blend](https://archive.blender.org/developer/F12920355/drivers_crash.blend)
Germano Cavalcante changed title from Crash when performing F12 render or spacebar animation on certain models in 3.1 to Crash when accessing a shapekey property of a Mesh in a driver of another Mesh 2022-03-10 22:21:39 +01:00
Author

This comment was removed by @poopoo

*This comment was removed by @poopoo*
Author

Thanks for identifying the cause.
I have created a simplified version with only one shape key from your file.

drivers_crash-simplied_only_one_shapekey.blend

Thanks for identifying the cause. I have created a simplified version with only one shape key from your file. [drivers_crash-simplied_only_one_shapekey.blend](https://archive.blender.org/developer/F12920627/drivers_crash-simplied_only_one_shapekey.blend)
Author

"accessing a shapekey property of a Mesh in a driver of another Mesh" does not necessarily cause a crash.

  • mesh A with shape key
  • Set the driver to the shape key of mesh B and refer to the shape key of A

Manually moving the A shape key does not cause a crash
Crashes when keyframes are set on A and animation is performed.

"accessing a shapekey property of a Mesh in a driver of another Mesh" does not necessarily cause a crash. - mesh A with shape key - Set the driver to the shape key of mesh B and refer to the shape key of A Manually moving the A shape key does not cause a crash Crashes when keyframes are set on A and animation is performed.

Thanks for the info and for simplifying the file even further. It sure helps!
I will update the description.

Thanks for the info and for simplifying the file even further. It sure helps! I will update the description.
Germano Cavalcante changed title from Crash when accessing a shapekey property of a Mesh in a driver of another Mesh to Crash when accessing an animated shapekey property of a Mesh in a driver of another Mesh 2022-03-11 14:15:18 +01:00
Author

This comment was removed by @poopoo

*This comment was removed by @poopoo*
Author

Sorry to keep writing additional information.
I have found one more crashing condition to report.

Safe Driver setting in 3.1

SingleProperty
Prop = Key
Path=key_blocks["Key 1"].value

Crash Driver setting in 3.1 ( safe in 3.0)

SingleProperty
Prop = object
Path=data.shape_keys.key_blocks["Key 1"].value

driver=object-crash.blend

driver=key-safe.blend

Sorry to keep writing additional information. I have found one more crashing condition to report. ### Safe Driver setting in 3.1 SingleProperty Prop = Key Path=key_blocks["Key 1"].value ### Crash Driver setting in 3.1 ( safe in 3.0) SingleProperty Prop = object Path=data.shape_keys.key_blocks["Key 1"].value [driver=object-crash.blend](https://archive.blender.org/developer/F12921418/driver_object-crash.blend) [driver=key-safe.blend](https://archive.blender.org/developer/F12921419/driver_key-safe.blend)
Germano Cavalcante changed title from Crash when accessing an animated shapekey property of a Mesh in a driver of another Mesh to Crash when accessing animated 'object.data' property in a driver of a Mesh 2022-03-11 14:57:42 +01:00
Philipp Oeser changed title from Crash when accessing animated 'object.data' property in a driver of a Mesh to Regression: Crash when accessing animated 'object.data' property in a driver of a Mesh 2022-03-22 16:08:07 +01:00
Member

Added subscribers: @kevindietrich, @lichtwerk

Added subscribers: @kevindietrich, @lichtwerk
Member

Apparently, this is caused by 56407432a6

CC @kevindietrich : mind checking?

Apparently, this is caused by 56407432a6 CC @kevindietrich : mind checking?

Added subscribers: @Sergey, @dr.sybren

Added subscribers: @Sergey, @dr.sybren

In #96289#1321103, @poopoo wrote:
Sorry to keep writing additional information.

Better to share than to keep secret :)

This seems to be the same issue as #97710 (Regression: Crash When Appending Items and Editing Expressions).

Having data.shape_keys.key_blocks["Key 1"].value as driver variable expression has never (AFAIK, anyway) been safe since Blender 2.80 (which introduced the new-at-the-time depsgraph). #97710 has an example file that can crash 2.80 as well, even though it looked like 56407432a6 caused the issue. I think that commit simply changed the threading behaviour and caused the prior problem to become more prominent.

You can have the driver variable target the key directly, but the problem is that the shapekey names are not shown anywhere in the UI. They're always called Key.nnn, making it hard to work with. What you can do is target the Mesh instead, and use shape_keys.key_blocks["Key 1"].value (i.e. just remove the data. from the old path).

@Sergey do you think this analysis is correct?

> In #96289#1321103, @poopoo wrote: > Sorry to keep writing additional information. Better to share than to keep secret :) This seems to be the same issue as #97710 (Regression: Crash When Appending Items and Editing Expressions). Having `data.shape_keys.key_blocks["Key 1"].value` as driver variable expression has never (AFAIK, anyway) been safe since Blender 2.80 (which introduced the new-at-the-time depsgraph). #97710 has an example file that can crash 2.80 as well, even though it looked like 56407432a6 caused the issue. I think that commit simply changed the threading behaviour and caused the prior problem to become more prominent. You can have the driver variable target the key directly, but the problem is that the shapekey names are not shown anywhere in the UI. They're always called `Key.nnn`, making it hard to work with. What you can do is target the Mesh instead, and use `shape_keys.key_blocks["Key 1"].value` (i.e. just remove the `data.` from the old path). @Sergey do you think this analysis is correct?

Added subscriber: @ChrisJones

Added subscriber: @ChrisJones

@dr.sybren, I vaguely remember the issue. Also remember some work was done on it. The crash is never good, and it is not an implicit design limitation of drivers referring to other IDs. In contrast, it should be totally possible to reference any ID from the expression. Think either we are missing a relation, or we need to do something special to keep shapekeys on the result so that values can be used from them (the latter one is AFAIR the patch you've worked on a while ago. Think it was committed but some of the optimization work later one might have undone it).

@dr.sybren, I vaguely remember the issue. Also remember some work was done on it. The crash is never good, and it is not an implicit design limitation of drivers referring to other IDs. In contrast, it should be totally possible to reference any ID from the expression. Think either we are missing a relation, or we need to do something special to keep shapekeys on the result so that values can be used from them (the latter one is AFAIR the patch you've worked on a while ago. Think it was committed but some of the optimization work later one might have undone it).
Author

Thanks for the info.

I will comment on one point.

In Japanese amateur 3D user, a tool called MMD (Miku Miku Dance) is very popular and has a extensive collection of animation style model and motion assets.
There is an add-on called mmd_tools that uses this asset for MMD in blender, but since this add-on uses this crashing shape key setting internally, mmd_tools users are unable to use blender 3.1 or later.

I understand that blender has various priorities for adding features and bug fixes, and usually, if there is a simple workaround, bug fixes are not a priority, but I wanted to tell you above that in some communities this bug has a significant impact.

Another idea is to address the issue on the mmd_tools side, but the maintainer does not intend to fix this issue with the bug/spec on the blender side yet to be finalized.

Thanks for the info. I will comment on one point. In Japanese amateur 3D user, a tool called MMD (Miku Miku Dance) is very popular and has a extensive collection of animation style model and motion assets. There is an add-on called mmd_tools that uses this asset for MMD in blender, but since this add-on uses this crashing shape key setting internally, mmd_tools users are unable to use blender 3.1 or later. I understand that blender has various priorities for adding features and bug fixes, and usually, if there is a simple workaround, bug fixes are not a priority, but I wanted to tell you above that in some communities this bug has a significant impact. Another idea is to address the issue on the mmd_tools side, but the maintainer does not intend to fix this issue with the bug/spec on the blender side yet to be finalized.
Sybren A. Stüvel self-assigned this 2022-05-05 12:03:40 +02:00

My earlier analysis wasn't quite correct, as it turns out adding an RNAPathKey relation already does the RNA path parsing. The crash seems to be caused by the changed semantics of object.data: before 56407432a6 it was safe to use when the pointer is valid, so even when the data it points to was not yet evaluated properly. This has now changed, but the depsgraph relations haven't been updated to account for this.

My earlier analysis wasn't quite correct, as it turns out adding an `RNAPathKey` relation already does the RNA path parsing. The crash seems to be caused by the changed semantics of `object.data`: before 56407432a6 it was safe to use when the pointer is valid, so even when the data it points to was not yet evaluated properly. This has now changed, but the depsgraph relations haven't been updated to account for this.
Sybren A. Stüvel removed their assignment 2022-05-09 12:47:13 +02:00
Sybren A. Stüvel self-assigned this 2022-05-16 10:40:22 +02:00

This issue was referenced by a2dacefb46

This issue was referenced by a2dacefb46363cac5abd7d0d5dcbf9ff2764bef7

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
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
7 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#96289
No description provided.