Page MenuHome

Crash when rapitedly setting custom property on material node tree
Open, Confirmed, MediumPublic

Description

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: rBf6cb5f54494e
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:

  1. 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)

Details

Type
Bug

Event Timeline

Simon (notallowed) updated the task description. (Show Details)

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.

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

Philipp Oeser (lichtwerk) triaged this task as Confirmed, Medium priority.

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 (jbakker), @Clément Foucault (fclem) might know more?