Page MenuHome

'Object lost data' on copy-pasting
Closed, ResolvedPublicBUG

Description

System Information
Operating system: Windows-10-10.0.18362-SP0 64 Bits
Graphics card: GeForce RTX 2080 SUPER/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 445.75

Blender Version
Broken: version: 2.83 (sub 15), branch: master, commit date: 2020-04-26 22:51, hash: rBd0d16eb7d347
Worked: 2.82

Short description of error
When Paste command is used, some linked objects sometimes loose data and become Empties or disappear completely. Sometimes only 1-2 objects are removed and I only notice this later when the autosaves were overwritten. This was never an issue on 2.82.

Exact steps for others to reproduce the error

  • Copy the default cube
  • Move the cube.
  • Undo
  • Paste

There's cube.001 in the scene. camera and light are lost.

Info: Total files 0 | Changed 0 | Failed 0
Info: Copied 1 selected object(s)

Object Camera lost data.
Warning: Warning in console
Object Light lost data.
Warning: Warning in console
Info: 1 object(s) pasted

Event Timeline

Philipp Oeser (lichtwerk) changed the task status from Needs Triage to Confirmed.Apr 28 2020, 1:26 PM
Philipp Oeser (lichtwerk) changed the subtype of this task from "Report" to "Bug".

Can confirm, also running into following assert here:

BLI_assert failed: /blender/source/blender/depsgraph/intern/depsgraph_query_iter.cc:215, deg_iterator_objects_step(), at 'DEG::deg_validate_copy_on_write_datablock(&object->id)'

Doesnt seem to be an issue with the Legacy Undo

@Bastien Montagne (mont29): does this ring a bell?

Bastien Montagne (mont29) triaged this task as High priority.
Bastien Montagne (mont29) edited projects, added BF Blender (2.83); removed BF Blender.

From the backtrace and error messages below looks like the obdata pointers are lost or corrupted, so indeed almost certainly caused by new undo code. Will check.

<........>
Object Cube.087 lost data.
Warning: Warning in console
Object Cube.088 lost data.
Warning: Warning in console
Object Cube.089 lost data.
Warning: Warning in console
Info: 6 object(s) pasted

=================================================================
==308815==ERROR: AddressSanitizer: heap-use-after-free on address 0x616000641da8 at pc 0x000008237d83 bp 0x7ffc30ac2d50 sp 0x7ffc30ac2d48
READ of size 1 at 0x616000641da8 thread T0
    #0 0x8237d82 in check_datablock_expanded /home/guest/blender/rc_src/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc:501
    #1 0x8237d82 in foreach_libblock_validate_callback /home/guest/blender/rc_src/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc:828
    #2 0x2f5b5d4 in library_foreach_ID_link /home/guest/blender/rc_src/source/blender/blenkernel/intern/lib_query.c:778
    #3 0x2f7eeee in BKE_library_foreach_ID_link /home/guest/blender/rc_src/source/blender/blenkernel/intern/lib_query.c:1311
    #4 0x8239c45 in DEG::deg_validate_copy_on_write_datablock(ID*) /home/guest/blender/rc_src/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc:1097
    #5 0x80fc922 in deg_iterator_objects_step /home/guest/blender/rc_src/source/blender/depsgraph/intern/depsgraph_query_iter.cc:215
    #6 0x80fde5a in DEG_iterator_objects_next /home/guest/blender/rc_src/source/blender/depsgraph/intern/depsgraph_query_iter.cc:302
    #7 0x117dcd45 in stats_update /home/guest/blender/rc_src/source/blender/editors/space_info/info_stats.c:387
    #8 0x117df767 in ED_info_stats_string /home/guest/blender/rc_src/source/blender/editors/space_info/info_stats.c:593
    #9 0x59853e1 in rna_Scene_statistics_string_get /home/guest/blender/rc_src/source/blender/makesrna/intern/rna_scene.c:931
    #10 0x59e7029 in Scene_statistics_call source/blender/makesrna/intern/rna_scene_gen.c:7966
    #11 0x53fe6c8 in RNA_function_call /home/guest/blender/rc_src/source/blender/makesrna/intern/rna_access.c:7604
    #12 0x5cd9e3c in pyrna_func_call /home/guest/blender/rc_src/source/blender/python/intern/bpy_rna.c:6326
    #13 0x7fd934503886 in _PyObject_FastCallKeywords (/lib/x86_64-linux-gnu/libpython3.7m.so.1.0+0x25e886)
    #14 0x7fd934312fc2  (/lib/x86_64-linux-gnu/libpython3.7m.so.1.0+0x6dfc2)
    #15 0x7fd934319c41 in _PyEval_EvalFrameDefault (/lib/x86_64-linux-gnu/libpython3.7m.so.1.0+0x74c41)
    #16 0x7fd93431c94a  (/lib/x86_64-linux-gnu/libpython3.7m.so.1.0+0x7794a)
    #17 0x7fd934502f97 in _PyFunction_FastCallDict (/lib/x86_64-linux-gnu/libpython3.7m.so.1.0+0x25df97)
    #18 0x5ce4e3a in bpy_class_call /home/guest/blender/rc_src/source/blender/python/intern/bpy_rna.c:8505
    #19 0x5b1d907 in header_draw /home/guest/blender/rc_src/source/blender/makesrna/intern/rna_ui.c:702
    #20 0x5dbcf55 in ED_region_header_layout /home/guest/blender/rc_src/source/blender/editors/screen/area.c:2779
    #21 0x5d97877 in ED_region_do_layout /home/guest/blender/rc_src/source/blender/editors/screen/area.c:500
    #22 0x40f6803 in wm_draw_window_offscreen /home/guest/blender/rc_src/source/blender/windowmanager/intern/wm_draw.c:644
    #23 0x40f7f36 in wm_draw_window /home/guest/blender/rc_src/source/blender/windowmanager/intern/wm_draw.c:813
    #24 0x40f93de in wm_draw_update /home/guest/blender/rc_src/source/blender/windowmanager/intern/wm_draw.c:1021
    #25 0x40ea8bd in WM_main /home/guest/blender/rc_src/source/blender/windowmanager/intern/wm.c:456
    #26 0x2d0a589 in main /home/guest/blender/rc_src/source/creator/creator.c:524
    #27 0x7fd932113e0a in __libc_start_main ../csu/libc-start.c:308
    #28 0x2d09759 in _start (/home/guest/blender/build_rc_debug/bin/blender+0x2d09759)

0x616000641da8 is located 40 bytes inside of 568-byte region [0x616000641d80,0x616000641fb8)
freed by thread T0 here:
    #0 0x7fd937305277 in __interceptor_free (/lib/x86_64-linux-gnu/libasan.so.5+0x107277)
    #1 0x14557064 in MEM_lockfree_freeN /home/guest/blender/rc_src/intern/guardedalloc/intern/mallocn_lockfree_impl.c:157
    #2 0x812e023 in free_copy_on_write_datablock /home/guest/blender/rc_src/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc:130
    #3 0x1425c646 in ghash_free_cb /home/guest/blender/rc_src/source/blender/blenlib/intern/BLI_ghash.c:650
    #4 0x142629cf in BLI_ghash_free /home/guest/blender/rc_src/source/blender/blenlib/intern/BLI_ghash.c:1023
    #5 0x812ecf9 in DEG::DepsgraphNodeBuilder::~DepsgraphNodeBuilder() /home/guest/blender/rc_src/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc:158
    #6 0x80cbc92 in DEG_graph_build_from_view_layer /home/guest/blender/rc_src/source/blender/depsgraph/intern/depsgraph_build.cc:245
    #7 0x80d060c in DEG_graph_relations_update /home/guest/blender/rc_src/source/blender/depsgraph/intern/depsgraph_build.cc:499
    #8 0x33a6858 in scene_graph_update_tagged /home/guest/blender/rc_src/source/blender/blenkernel/intern/scene.c:1311
    #9 0x33a698a in BKE_scene_graph_update_tagged /home/guest/blender/rc_src/source/blender/blenkernel/intern/scene.c:1358
    #10 0x40fc72b in wm_event_do_depsgraph /home/guest/blender/rc_src/source/blender/windowmanager/intern/wm_event_system.c:359
    #11 0x40fca7a in wm_event_do_refresh_wm_and_depsgraph /home/guest/blender/rc_src/source/blender/windowmanager/intern/wm_event_system.c:385
    #12 0x40fe9d5 in wm_event_do_notifiers /home/guest/blender/rc_src/source/blender/windowmanager/intern/wm_event_system.c:550
    #13 0x40ea8b1 in WM_main /home/guest/blender/rc_src/source/blender/windowmanager/intern/wm.c:453
    #14 0x2d0a589 in main /home/guest/blender/rc_src/source/creator/creator.c:524
    #15 0x7fd932113e0a in __libc_start_main ../csu/libc-start.c:308

previously allocated by thread T0 here:
    #0 0x7fd93730580e in calloc (/lib/x86_64-linux-gnu/libasan.so.5+0x10780e)
    #1 0x145577b3 in MEM_lockfree_callocN /home/guest/blender/rc_src/intern/guardedalloc/intern/mallocn_lockfree_impl.c:267
    #2 0x2f12391 in BKE_libblock_alloc_notest /home/guest/blender/rc_src/source/blender/blenkernel/intern/lib_id.c:989
    #3 0x80b7c3e in DEG::IDNode::init_copy_on_write(ID*) /home/guest/blender/rc_src/source/blender/depsgraph/intern/node/deg_node_id.cc:139
    #4 0x80c1701 in DEG::Depsgraph::add_id_node(ID*, ID*) /home/guest/blender/rc_src/source/blender/depsgraph/intern/depsgraph.cc:130
    #5 0x812f5fa in DEG::DepsgraphNodeBuilder::add_id_node(ID*) /home/guest/blender/rc_src/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc:178
    #6 0x814667b in DEG::DepsgraphNodeBuilder::build_parameters(ID*) /home/guest/blender/rc_src/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc:1036
    #7 0x8152d5a in DEG::DepsgraphNodeBuilder::build_camera(Camera*) /home/guest/blender/rc_src/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc:1435
    #8 0x813fa46 in DEG::DepsgraphNodeBuilder::build_object_data_camera(Object*) /home/guest/blender/rc_src/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc:783
    #9 0x813f028 in DEG::DepsgraphNodeBuilder::build_object_data(Object*, bool) /home/guest/blender/rc_src/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc:756
    #10 0x813beb1 in DEG::DepsgraphNodeBuilder::build_object(int, Object*, DEG::eDepsNode_LinkedState_Type, bool) /home/guest/blender/rc_src/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc:643
    #11 0x81a5eae in DEG::DepsgraphNodeBuilder::build_view_layer(Scene*, ViewLayer*, DEG::eDepsNode_LinkedState_Type) /home/guest/blender/rc_src/source/blender/depsgraph/intern/builder/deg_builder_nodes_view_layer.cc:118
    #12 0x80cb662 in DEG_graph_build_from_view_layer /home/guest/blender/rc_src/source/blender/depsgraph/intern/depsgraph_build.cc:247
    #13 0x80d060c in DEG_graph_relations_update /home/guest/blender/rc_src/source/blender/depsgraph/intern/depsgraph_build.cc:499
    #14 0x40fc6e5 in wm_event_do_depsgraph /home/guest/blender/rc_src/source/blender/windowmanager/intern/wm_event_system.c:355
    #15 0x4135b56 in wm_file_read_post /home/guest/blender/rc_src/source/blender/windowmanager/intern/wm_files.c:561
    #16 0x413689b in WM_file_read /home/guest/blender/rc_src/source/blender/windowmanager/intern/wm_files.c:683
    #17 0x4141941 in wm_file_read_opwrap /home/guest/blender/rc_src/source/blender/windowmanager/intern/wm_files.c:2110
    #18 0x4142c05 in wm_open_mainfile__open /home/guest/blender/rc_src/source/blender/windowmanager/intern/wm_files.c:2252
    #19 0x4142eb0 in wm_open_mainfile_exec /home/guest/blender/rc_src/source/blender/windowmanager/intern/wm_files.c:2288
    #20 0x410ffb0 in wm_handler_fileselect_do /home/guest/blender/rc_src/source/blender/windowmanager/intern/wm_event_system.c:2275
    #21 0x4111776 in wm_handler_fileselect_call /home/guest/blender/rc_src/source/blender/windowmanager/intern/wm_event_system.c:2373
    #22 0x41163b4 in wm_handlers_do_intern /home/guest/blender/rc_src/source/blender/windowmanager/intern/wm_event_system.c:2784
    #23 0x4116704 in wm_handlers_do /home/guest/blender/rc_src/source/blender/windowmanager/intern/wm_event_system.c:2836
    #24 0x411bd13 in wm_event_do_handlers /home/guest/blender/rc_src/source/blender/windowmanager/intern/wm_event_system.c:3231
    #25 0x40ea8a5 in WM_main /home/guest/blender/rc_src/source/blender/windowmanager/intern/wm.c:450
    #26 0x2d0a589 in main /home/guest/blender/rc_src/source/creator/creator.c:524
    #27 0x7fd932113e0a in __libc_start_main ../csu/libc-start.c:308

SUMMARY: AddressSanitizer: heap-use-after-free /home/guest/blender/rc_src/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc:501 in check_datablock_expanded
Shadow bytes around the buggy address:
  0x0c2c800c0360: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c2c800c0370: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c2c800c0380: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c2c800c0390: fd fd fd fd fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c2c800c03a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
=>0x0c2c800c03b0: fd fd fd fd fd[fd]fd fd fd fd fd fd fd fd fd fd
  0x0c2c800c03c0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c2c800c03d0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c2c800c03e0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c2c800c03f0: fd fd fd fd fd fd fd fa fa fa fa fa fa fa fa fa
  0x0c2c800c0400: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07 
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
  Shadow gap:              cc
==308815==ABORTING

Uh, small tiny stupid mistake in new undo code, that was basically potentially breaking any link/append operation (copy/pasting data-blocks relies on ID linking code under the hood). Luckily fix is trivial, commit incoming.