Crash when rapitedly setting custom property on material node tree #68406

Closed
opened 2019-08-08 12:02:32 +02:00 by notallowed · 9 comments

System Information
Operating system: Linux-4.15.0-55-generic-x86_64-with-debian-buster-sid 64 Bits
Graphics card: GeForce GTX 1070 Ti/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 430.40

Blender Version
Broken: version: 2.80 (sub 75), branch: master, commit date: 2019-07-29 14:47, hash: f6cb5f5449
Worked: (optional)

Short description of error
When using custom properties defined via Python on materials node tree, blender will crash after you set the property for a few times.

Exact steps for others to reproduce the error
First variant:

  1. Open attached blend file:
    crash_test.blend
  2. Run the script
    Second variant:
  3. Open default blend file.
  4. Run this script:
import bpy

def timer():
    material = bpy.data.materials["Material"]
    material.blend_method = "OPAQUE"
    node_tree = material.node_tree
    node_tree["test"] = "test"    
    return 0.01

bpy.app.timers.register(timer, first_interval=0.01)
**System Information** Operating system: Linux-4.15.0-55-generic-x86_64-with-debian-buster-sid 64 Bits Graphics card: GeForce GTX 1070 Ti/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 430.40 **Blender Version** Broken: version: 2.80 (sub 75), branch: master, commit date: 2019-07-29 14:47, hash: `f6cb5f5449` Worked: (optional) **Short description of error** When using custom properties defined via Python on materials node tree, blender will crash after you set the property for a few times. **Exact steps for others to reproduce the error** First variant: 1. Open attached blend file: [crash_test.blend](https://archive.blender.org/developer/F7654235/crash_test.blend) 2. Run the script Second variant: 1. Open default blend file. 2. Run this script: ``` import bpy def timer(): material = bpy.data.materials["Material"] material.blend_method = "OPAQUE" node_tree = material.node_tree node_tree["test"] = "test" return 0.01 bpy.app.timers.register(timer, first_interval=0.01) ```
Author

Added subscriber: @simon_lusenc

Added subscriber: @simon_lusenc

Added subscriber: @angavrilov

Added subscriber: @angavrilov

If you run blender with --debug-memory, it spams complaints about 'double free', and that happens even with a very much simplified test:

import bpy

def timer():
    material = bpy.data.materials["Material"]
    material.blend_method = "OPAQUE"
    node_tree = material.node_tree
    node_tree["test"] = "test"    
    return 0.01

bpy.app.timers.register(timer, first_interval=0.01)

Assigning blend_method seems to be the critical part.

If you run blender with --debug-memory, it spams complaints about 'double free', and that happens even with a very much simplified test: ``` import bpy def timer(): material = bpy.data.materials["Material"] material.blend_method = "OPAQUE" node_tree = material.node_tree node_tree["test"] = "test" return 0.01 bpy.app.timers.register(timer, first_interval=0.01) ``` Assigning `blend_method` seems to be the critical part.
Author

Can confirm what angavrilov wrote, setting blend method together with assignment of custom property is a killer. Will update main post.

Can confirm what angavrilov wrote, setting blend method together with assignment of custom property is a killer. Will update main post.
Member

Added subscribers: @fclem, @Jeroen-Bakker, @lichtwerk

Added subscribers: @fclem, @Jeroen-Bakker, @lichtwerk
Member

Only happens when the Properties Editor, Material context of that particular material is open (doesnt happen in any other context or with a different material showing...)
Assume this is because of Material preview/thumbnail generation? [wasnt this delayed somehow to not slow down the UI while editing materials that much?]

1   std::__detail::_Hash_code_base<GPUBatch *, GPUBatch *, std::__detail::_Identity, std::hash<GPUBatch *>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, false>::_M_bucket_index                                                                                                                                    hashtable_policy.h  1300 0x6c5f12f 
2   std::_Hashtable<GPUBatch *, GPUBatch *, std::allocator<GPUBatch *>, std::__detail::_Identity, std::equal_to<GPUBatch *>, std::hash<GPUBatch *>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, true, true>>::_M_bucket_index         hashtable.h         640  0x6c5e8cf 
3   std::_Hashtable<GPUBatch *, GPUBatch *, std::allocator<GPUBatch *>, std::__detail::_Identity, std::equal_to<GPUBatch *>, std::hash<GPUBatch *>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, true, true>>::_M_find_before_node     hashtable.h         1554 0x6c5dc93 
4   std::_Hashtable<GPUBatch *, GPUBatch *, std::allocator<GPUBatch *>, std::__detail::_Identity, std::equal_to<GPUBatch *>, std::hash<GPUBatch *>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, true, true>>::_M_find_node            hashtable.h         655  0x6c5da30 
5   std::_Hashtable<GPUBatch *, GPUBatch *, std::allocator<GPUBatch *>, std::__detail::_Identity, std::equal_to<GPUBatch *>, std::hash<GPUBatch *>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, true, true>>::_M_emplace<GPUBatch *&> hashtable.h         1658 0x6c5d295 
6   std::_Hashtable<GPUBatch *, GPUBatch *, std::allocator<GPUBatch *>, std::__detail::_Identity, std::equal_to<GPUBatch *>, std::hash<GPUBatch *>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, true, true>>::emplace<GPUBatch *&>    hashtable.h         749  0x6c5cf78 
7   std::unordered_set<GPUBatch *>::emplace<GPUBatch *&>                                                                                                                                                                                                                                                                                       unordered_set.h     377  0x6c5c9ae 
8   gpu_context_add_batch                                                                                                                                                                                                                                                                                                                      gpu_context.cpp     291  0x6c5c1c3 
9   batch_vao_get                                                                                                                                                                                                                                                                                                                              gpu_batch.c         236  0x6c4f899 
10  GPU_batch_program_set_no_use                                                                                                                                                                                                                                                                                                               gpu_batch.c         323  0x6c4fc4e 
11  GPU_batch_program_set                                                                                                                                                                                                                                                                                                                      gpu_batch.c         328  0x6c4fc80 
12  GPU_batch_program_set_builtin_with_config                                                                                                                                                                                                                                                                                                  gpu_batch.c         681  0x6c50d14 
13  GPU_batch_program_set_builtin                                                                                                                                                                                                                                                                                                              gpu_batch.c         686  0x6c50d3c 
14  UI_widgetbase_draw_cache_flush                                                                                                                                                                                                                                                                                                             interface_widgets.c 1251 0x2ad5798 
15  icon_draw_size                                                                                                                                                                                                                                                                                                                             interface_icons.c   1811 0x2a93ff2 
16  UI_icon_draw_ex                                                                                                                                                                                                                                                                                                                            interface_icons.c   2277 0x2a95343 
17  widget_draw_icon                                                                                                                                                                                                                                                                                                                           interface_widgets.c 1526 0x2ad64aa 
18  widget_draw_text_icon                                                                                                                                                                                                                                                                                                                      interface_widgets.c 2387 0x2ad873c 
19  ui_draw_but                                                                                                                                                                                                                                                                                                                                interface_widgets.c 4827 0x2ae0747 
20  UI_block_draw                                                                                                                                                                                                                                                                                                                              interface.c         1710 0x2a5babc 

@Jeroen-Bakker, @fclem might know more?

Only happens when the `Properties Editor`, `Material` context of that particular material is open (doesnt happen in any other context or with a different material showing...) Assume this is because of Material preview/thumbnail generation? [wasnt this delayed somehow to not slow down the UI while editing materials that much?] ``` 1 std::__detail::_Hash_code_base<GPUBatch *, GPUBatch *, std::__detail::_Identity, std::hash<GPUBatch *>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, false>::_M_bucket_index hashtable_policy.h 1300 0x6c5f12f 2 std::_Hashtable<GPUBatch *, GPUBatch *, std::allocator<GPUBatch *>, std::__detail::_Identity, std::equal_to<GPUBatch *>, std::hash<GPUBatch *>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, true, true>>::_M_bucket_index hashtable.h 640 0x6c5e8cf 3 std::_Hashtable<GPUBatch *, GPUBatch *, std::allocator<GPUBatch *>, std::__detail::_Identity, std::equal_to<GPUBatch *>, std::hash<GPUBatch *>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, true, true>>::_M_find_before_node hashtable.h 1554 0x6c5dc93 4 std::_Hashtable<GPUBatch *, GPUBatch *, std::allocator<GPUBatch *>, std::__detail::_Identity, std::equal_to<GPUBatch *>, std::hash<GPUBatch *>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, true, true>>::_M_find_node hashtable.h 655 0x6c5da30 5 std::_Hashtable<GPUBatch *, GPUBatch *, std::allocator<GPUBatch *>, std::__detail::_Identity, std::equal_to<GPUBatch *>, std::hash<GPUBatch *>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, true, true>>::_M_emplace<GPUBatch *&> hashtable.h 1658 0x6c5d295 6 std::_Hashtable<GPUBatch *, GPUBatch *, std::allocator<GPUBatch *>, std::__detail::_Identity, std::equal_to<GPUBatch *>, std::hash<GPUBatch *>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, true, true>>::emplace<GPUBatch *&> hashtable.h 749 0x6c5cf78 7 std::unordered_set<GPUBatch *>::emplace<GPUBatch *&> unordered_set.h 377 0x6c5c9ae 8 gpu_context_add_batch gpu_context.cpp 291 0x6c5c1c3 9 batch_vao_get gpu_batch.c 236 0x6c4f899 10 GPU_batch_program_set_no_use gpu_batch.c 323 0x6c4fc4e 11 GPU_batch_program_set gpu_batch.c 328 0x6c4fc80 12 GPU_batch_program_set_builtin_with_config gpu_batch.c 681 0x6c50d14 13 GPU_batch_program_set_builtin gpu_batch.c 686 0x6c50d3c 14 UI_widgetbase_draw_cache_flush interface_widgets.c 1251 0x2ad5798 15 icon_draw_size interface_icons.c 1811 0x2a93ff2 16 UI_icon_draw_ex interface_icons.c 2277 0x2a95343 17 widget_draw_icon interface_widgets.c 1526 0x2ad64aa 18 widget_draw_text_icon interface_widgets.c 2387 0x2ad873c 19 ui_draw_but interface_widgets.c 4827 0x2ae0747 20 UI_block_draw interface.c 1710 0x2a5babc ``` @Jeroen-Bakker, @fclem might know more?
Member

It is not reproducable via the small script, but the file still fails. On my machine it crashes in the driver. Perhaps another thread is free-ing resources that is still used during drawing.

In other parts in blender we lock the rendering. But that isn't possible here. There are more related issues eg rendering with a frame change.

It is not reproducable via the small script, but the file still fails. On my machine it crashes in the driver. Perhaps another thread is free-ing resources that is still used during drawing. In other parts in blender we lock the rendering. But that isn't possible here. There are more related issues eg rendering with a frame change.

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Campbell Barton self-assigned this 2020-09-18 13:17:44 +02:00

Closed as duplicate of #80238

Closed as duplicate of #80238
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
5 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#68406
No description provided.