Maniphest T68406

Crash when rapitedly setting custom property on material node tree
Closed, DuplicateBUG

Assigned To
Campbell Barton (campbellbarton)
Authored By
Simon (notallowed)
Aug 8 2019, 12:02 PM
Tags
  • BF Blender
  • Python API
  • EEVEE & Viewport
Subscribers
Alexander Gavrilov (angavrilov)
Clément Foucault (fclem)
Jeroen Bakker (jbakker)
Philipp Oeser (lichtwerk)
Simon (notallowed)

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)

Event Timeline

Simon (notallowed) created this task.Aug 8 2019, 12:02 PM
Simon (notallowed) updated the task description.
Simon (notallowed) updated the task description.Aug 8 2019, 12:27 PM
Alexander Gavrilov (angavrilov) added a subscriber: Alexander Gavrilov (angavrilov).Aug 8 2019, 1:09 PM

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.

Simon (notallowed) added a comment.Aug 8 2019, 1:14 PM

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

Simon (notallowed) updated the task description.Aug 8 2019, 1:15 PM
Philipp Oeser (lichtwerk) lowered the priority of this task from 90 to 50.Aug 8 2019, 1:29 PM
Philipp Oeser (lichtwerk) added a project: GPU / Viewport.
Philipp Oeser (lichtwerk) added subscribers: Clément Foucault (fclem), Jeroen Bakker (jbakker), Philipp Oeser (lichtwerk).

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?

Philipp Oeser (lichtwerk) added projects: Add-ons (BF-Blender), Nodes.Aug 8 2019, 1:30 PM
Dalai Felinto (dfelinto) added a project: Tracker Curfew.Dec 23 2019, 4:33 PM
Jeroen Bakker (jbakker) changed the subtype of this task from "Report" to "Known Issue".Jan 10 2020, 2:42 PM
Jeroen Bakker (jbakker) removed projects: Tracker Curfew, Nodes.

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.

Campbell Barton (campbellbarton) edited projects, added Python API; removed Add-ons (BF-Blender).Jun 19 2020, 9:50 AM
Campbell Barton (campbellbarton) moved this task from Backlog to Bugs (API) on the Python API board.Jun 19 2020, 10:01 AM
Campbell Barton (campbellbarton) moved this task from Bugs (API) to Known Issues on the Python API board.Jun 19 2020, 11:05 AM
Clément Foucault (fclem) edited projects, added EEVEE & Viewport; removed GPU / Viewport.Jun 19 2020, 10:23 PM
Clément Foucault (fclem) moved this task from Backlog to Known Issues on the EEVEE & Viewport board.Jul 1 2020, 7:29 PM
Campbell Barton (campbellbarton) closed this task as Resolved.Sep 18 2020, 1:17 PM
Campbell Barton (campbellbarton) claimed this task.
Campbell Barton (campbellbarton) closed this task as a duplicate of T80238: Crash on Node Tree Custom Property Update function.
Campbell Barton (campbellbarton) changed the subtype of this task from "Known Issue" to "Bug".