Segfault pasting stale driver. #88482

Open
opened 2021-05-22 16:06:55 +02:00 by Will · 6 comments

System Information
Operating system: Linux
Graphics card: Intel

Blender Version
Broken: 2.92

Short description of error

Drives copied and pasted with significant change in file data in between can trigger segfaults.

# Blender 2.92.0, Commit date: 2021-02-24 16:25, Hash 02948a2cab44

# backtrace
blender(BLI_system_backtrace+0x34) [0x55dfd70fd084]
blender(+0xe151bd) [0x55dfd4bd41bd]
/usr/lib/libc.so.6(+0x3cf80) [0x7f9b26870f80]
blender(_ZN7blender3deg20DepsgraphNodeBuilder26build_object_data_geometryEP6Objectb+0x170) [0x55dfd7000380]
blender(_ZN7blender3deg20DepsgraphNodeBuilder17build_object_dataEP6Objectb+0x54) [0x55dfd6ffb4b4]
blender(_ZN7blender3deg20DepsgraphNodeBuilder12build_objectEiP6ObjectNS0_26eDepsNode_LinkedState_TypeEb+0x1d3) [0x55dfd6ffe2c3]
blender(_ZN7blender3deg20DepsgraphNodeBuilder22build_driver_variablesEP2IDP6FCurve+0x77) [0x55dfd6ffad87]
blender(_ZN7blender3deg20DepsgraphNodeBuilder14build_animdataEP2ID+0x1f9) [0x55dfd6ffe8b9]
blender(_ZN7blender3deg20DepsgraphNodeBuilder12build_objectEiP6ObjectNS0_26eDepsNode_LinkedState_TypeEb+0x228) [0x55dfd6ffe318]
blender(_ZN7blender3deg20DepsgraphNodeBuilder16build_view_layerEP5SceneP9ViewLayerNS0_26eDepsNode_LinkedState_TypeE+0xb2) [0x55dfd7003892]
blender(_ZN7blender3deg23AbstractBuilderPipeline16build_step_nodesEv+0x76) [0x55dfd6fea296]
blender(_ZN7blender3deg23AbstractBuilderPipeline5buildEv+0x42) [0x55dfd6fea4b2]
blender(DEG_graph_build_from_view_layer+0x33) [0x55dfd6fd24e3]
blender(+0xef501a) [0x55dfd4cb401a]
blender(wm_event_do_depsgraph+0xc5) [0x55dfd4f59245]
blender(wm_event_do_refresh_wm_and_depsgraph+0x92) [0x55dfd4f593b2]
blender(wm_event_do_notifiers+0x36a) [0x55dfd4f6055a]
blender(WM_main+0x2b) [0x55dfd4f5532b]
blender(main+0x367) [0x55dfd4b9da67]
/usr/lib/libc.so.6(__libc_start_main+0xd5) [0x7f9b2685bb25]
blender(_start+0x2e) [0x55dfd4bd056e]

# Python backtrace

Exact steps for others to reproduce the error

  • Add a custom property to the Scene.

  • Right click on its value field, and run "Copy as New Driver".

  • Run CTRL+N or "File" —> "New" —> "General".

  • Right click on any value field, and run "Paste Driver".

**System Information** Operating system: Linux Graphics card: Intel **Blender Version** Broken: 2.92 **Short description of error** Drives copied and pasted with significant change in file data in between can trigger segfaults. ``` # Blender 2.92.0, Commit date: 2021-02-24 16:25, Hash 02948a2cab44 # backtrace blender(BLI_system_backtrace+0x34) [0x55dfd70fd084] blender(+0xe151bd) [0x55dfd4bd41bd] /usr/lib/libc.so.6(+0x3cf80) [0x7f9b26870f80] blender(_ZN7blender3deg20DepsgraphNodeBuilder26build_object_data_geometryEP6Objectb+0x170) [0x55dfd7000380] blender(_ZN7blender3deg20DepsgraphNodeBuilder17build_object_dataEP6Objectb+0x54) [0x55dfd6ffb4b4] blender(_ZN7blender3deg20DepsgraphNodeBuilder12build_objectEiP6ObjectNS0_26eDepsNode_LinkedState_TypeEb+0x1d3) [0x55dfd6ffe2c3] blender(_ZN7blender3deg20DepsgraphNodeBuilder22build_driver_variablesEP2IDP6FCurve+0x77) [0x55dfd6ffad87] blender(_ZN7blender3deg20DepsgraphNodeBuilder14build_animdataEP2ID+0x1f9) [0x55dfd6ffe8b9] blender(_ZN7blender3deg20DepsgraphNodeBuilder12build_objectEiP6ObjectNS0_26eDepsNode_LinkedState_TypeEb+0x228) [0x55dfd6ffe318] blender(_ZN7blender3deg20DepsgraphNodeBuilder16build_view_layerEP5SceneP9ViewLayerNS0_26eDepsNode_LinkedState_TypeE+0xb2) [0x55dfd7003892] blender(_ZN7blender3deg23AbstractBuilderPipeline16build_step_nodesEv+0x76) [0x55dfd6fea296] blender(_ZN7blender3deg23AbstractBuilderPipeline5buildEv+0x42) [0x55dfd6fea4b2] blender(DEG_graph_build_from_view_layer+0x33) [0x55dfd6fd24e3] blender(+0xef501a) [0x55dfd4cb401a] blender(wm_event_do_depsgraph+0xc5) [0x55dfd4f59245] blender(wm_event_do_refresh_wm_and_depsgraph+0x92) [0x55dfd4f593b2] blender(wm_event_do_notifiers+0x36a) [0x55dfd4f6055a] blender(WM_main+0x2b) [0x55dfd4f5532b] blender(main+0x367) [0x55dfd4b9da67] /usr/lib/libc.so.6(__libc_start_main+0xd5) [0x7f9b2685bb25] blender(_start+0x2e) [0x55dfd4bd056e] # Python backtrace ``` **Exact steps for others to reproduce the error** * Add a custom property to the Scene. * Right click on its value field, and run "Copy as New Driver". * Run `CTRL`+`N` or "File" —> "New" —> "General". * Right click on any value field, and run "Paste Driver".
Author

Added subscriber: @WCN

Added subscriber: @WCN
Member

Added subscriber: @lichtwerk

Added subscriber: @lichtwerk
Member

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

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

Can confirm.

Can confirm.
Philipp Oeser removed the
Interest
Animation & Rigging
label 2023-02-09 14:35:35 +01:00
Philipp Oeser added the
Interest
Core
label 2023-02-10 11:09:26 +01:00
Member

Was able to reproduce on latest main (b664de2c8e).

However, initially I had trouble reproducing, and I'm not entirely sure why. (Just noting for anyone who comes along later.)

Was able to reproduce on latest `main` (b664de2c8e0f1cf449c2f32256dd535b3c6d0df9). However, initially I had trouble reproducing, and I'm not entirely sure why. (Just noting for anyone who comes along later.)
Nathan Vegdahl added
Type
Bug
and removed
Type
Report
labels 2023-06-06 12:09:01 +02:00
Member

I've tracked down the source of the bug, which turns out to be pretty simple. The issue is as follows:

There is a buffer channeldriver_copypaste_buf in drivers.cc that stores any copied driver for later pasting. However, it doesn't get cleared when the ID block that its driver points at disappears. So any time an ID block gets freed, it can potentially leave a dangling pointer in the driver in channeldriver_copypaste_buf.

In the provided repro steps this is accomplished by creating a new file, which frees the Scene block that the driver points at. But the bug can also be triggered by doing copy as driver on a property of an object, deleting that object, and then pasting the driver.

I'll work on figuring out what the most appropriate fix is.

I've tracked down the source of the bug, which turns out to be pretty simple. The issue is as follows: There is a buffer `channeldriver_copypaste_buf` in `drivers.cc` that stores any copied driver for later pasting. However, it doesn't get cleared when the ID block that its driver points at disappears. So any time an ID block gets freed, it can potentially leave a dangling pointer in the driver in `channeldriver_copypaste_buf`. In the provided repro steps this is accomplished by creating a new file, which frees the Scene block that the driver points at. But the bug can also be triggered by doing `copy as driver` on a property of an object, deleting that object, and then pasting the driver. I'll work on figuring out what the most appropriate fix is.
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
3 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#88482
No description provided.