Page MenuHome

Surface Deform Modifier produces inconsistent results when used on multiple objects
Closed, ResolvedPublic

Description

System Information:
Windows 10 and Radeon HD 5450

Blender Version:
2.78- 8560776

To view bug-
Turn on surface deform modifier on Eyebrows- Surface and Eye Lashes- Surface. Toggle Vyrath Surface's armature on and off repeatedly.

View again with surface deform active only on Eyebrows- Surface.

These surface deform modifiers should not interact with each-other in any way. However, when all surface deform modifiers are active, the result is different from the individual results when only one surface deform modifier is active.

Event Timeline

Bastien Montagne (mont29) lowered the priority of this task from 90 to 30.Mar 3 2017, 9:08 AM

I do not see any difference here, result of eyelashes is obviously different when enabled than disabled, since your Vyrath surface is deformed by armature in both eyebrows and eyelashes areas… Cannot see any issue here, please explain it in more details, and/or add pictures showing your issue.

Also next time, would be better to make a demo case with much simpler .blend file, production files are usually not necessary to report a bug, and quite a pita to handle and investigate.

The glitching should be fairly obvious. The eyebrows should vanish, or blender should crash.

Have you tried turning on all modifiers and spamming the armature on and off?

Bastien Montagne (mont29) raised the priority of this task from 30 to 50.

Aaaah… so it’s not a glitch, but a big nasty crash indeed!

Could reproduce by enabling also surface deform for actual eyelashes/eyebrows.

Eh, actually, it’s the new one from @Luca Rood (LucaRood)!

@Luca Rood (LucaRood) below is the ASAN report of the crash. Problem is actually not related to the modifier itself imho, but rather to how we handle dm->release().

DM_release() will free temp CD layers, if it’s not allowed to actually free the whole DM. Here, we get some concurrency where thread A allocates temp CD layer for verts array (due to subsurf ccgDM not storing those by default it’d seem), then thread B request same data and get same layer, then thread A has finished and calls tdm->release(tdm) which frees said vert array, then thread B tries to access that data…

@Sergey Sharybin (sergey) really not sure how to address this, except by not freeing anything in DM_release() when dm is not tagged to be freed?

=================================================================
==10614==ERROR: AddressSanitizer: heap-use-after-free on address 0x7f8235a08248 at pc 0x564fb50ca042 bp 0x7f823d92fe20 sp 0x7f823d92fe18
WRITE of size 4 at 0x7f8235a08248 thread T19
    #0 0x564fb50ca041 in copy_v3_v3 /home/i74700deb64/blender/__work__/src/source/blender/blenlib/intern/math_vector_inline.c:66
    #1 0x564fb50d359c in ccgDM_to_MVert /home/i74700deb64/blender/__work__/src/source/blender/blenkernel/intern/subsurf_ccg.c:1290
    #2 0x564fb50d359c in ccgDM_copyFinalVertArray /home/i74700deb64/blender/__work__/src/source/blender/blenkernel/intern/subsurf_ccg.c:1315
    #3 0x564fb4b1f2f6 in dm_getVertArray /home/i74700deb64/blender/__work__/src/source/blender/blenkernel/intern/DerivedMesh.c:110
    #4 0x564fb42f93d2 in surfacedeformModifier_do /home/i74700deb64/blender/__work__/src/source/blender/modifiers/intern/MOD_surfacedeform.c:1131
    #5 0x564fb42f94ee in deformVerts /home/i74700deb64/blender/__work__/src/source/blender/modifiers/intern/MOD_surfacedeform.c:1145
    #6 0x564fb4ea253c in modwrap_deformVerts /home/i74700deb64/blender/__work__/src/source/blender/blenkernel/intern/modifier.c:775
    #7 0x564fb4b2e927 in mesh_calc_modifiers /home/i74700deb64/blender/__work__/src/source/blender/blenkernel/intern/DerivedMesh.c:1985
    #8 0x564fb4b33ae8 in mesh_build_data /home/i74700deb64/blender/__work__/src/source/blender/blenkernel/intern/DerivedMesh.c:2628
    #9 0x564fb4b34596 in makeDerivedMesh /home/i74700deb64/blender/__work__/src/source/blender/blenkernel/intern/DerivedMesh.c:2725
    #10 0x564fb4f25f64 in BKE_object_handle_data_update /home/i74700deb64/blender/__work__/src/source/blender/blenkernel/intern/object_update.c:201
    #11 0x564fb4f0bf40 in BKE_object_handle_update_ex /home/i74700deb64/blender/__work__/src/source/blender/blenkernel/intern/object.c:2640
    #12 0x564fb5015e5b in scene_update_object_func /home/i74700deb64/blender/__work__/src/source/blender/blenkernel/intern/scene.c:1507
    #13 0x564fb588e9a2 in task_scheduler_thread_run /home/i74700deb64/blender/__work__/src/source/blender/blenlib/intern/task.c:326
    #14 0x7f8281900423 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x7423)
    #15 0x7f8277b3c9be in __clone (/lib/x86_64-linux-gnu/libc.so.6+0xe89be)

0x7f8235a08248 is located 150088 bytes inside of 676368-byte region [0x7f82359e3800,0x7f8235a88a10)
freed by thread T0 here:
    #0 0x7f82839c6a10 in free (/usr/lib/x86_64-linux-gnu/libasan.so.3+0xc1a10)
    #1 0x564fb5dae05a in MEM_lockfree_freeN /home/i74700deb64/blender/__work__/src/intern/guardedalloc/intern/mallocn_lockfree_impl.c:169
    #2 0x564fb4c6b71c in customData_free_layer__internal /home/i74700deb64/blender/__work__/src/source/blender/blenkernel/intern/customdata.c:1564
    #3 0x564fb4c6feb2 in CustomData_free_temporary /home/i74700deb64/blender/__work__/src/source/blender/blenkernel/intern/customdata.c:2136
    #4 0x564fb4b20f1a in DM_release /home/i74700deb64/blender/__work__/src/source/blender/blenkernel/intern/DerivedMesh.c:399
    #5 0x564fb50ec11f in ccgDM_release /home/i74700deb64/blender/__work__/src/source/blender/blenkernel/intern/subsurf_ccg.c:4000
    #6 0x564fb42f9467 in surfacedeformModifier_do /home/i74700deb64/blender/__work__/src/source/blender/modifiers/intern/MOD_surfacedeform.c:1137
    #7 0x564fb42f94ee in deformVerts /home/i74700deb64/blender/__work__/src/source/blender/modifiers/intern/MOD_surfacedeform.c:1145
    #8 0x564fb4ea253c in modwrap_deformVerts /home/i74700deb64/blender/__work__/src/source/blender/blenkernel/intern/modifier.c:775
    #9 0x564fb4b2e927 in mesh_calc_modifiers /home/i74700deb64/blender/__work__/src/source/blender/blenkernel/intern/DerivedMesh.c:1985
    #10 0x564fb4b33ae8 in mesh_build_data /home/i74700deb64/blender/__work__/src/source/blender/blenkernel/intern/DerivedMesh.c:2628
    #11 0x564fb4b34596 in makeDerivedMesh /home/i74700deb64/blender/__work__/src/source/blender/blenkernel/intern/DerivedMesh.c:2725
    #12 0x564fb4f25f64 in BKE_object_handle_data_update /home/i74700deb64/blender/__work__/src/source/blender/blenkernel/intern/object_update.c:201
    #13 0x564fb4f0bf40 in BKE_object_handle_update_ex /home/i74700deb64/blender/__work__/src/source/blender/blenkernel/intern/object.c:2640
    #14 0x564fb5015e5b in scene_update_object_func /home/i74700deb64/blender/__work__/src/source/blender/blenkernel/intern/scene.c:1507
    #15 0x564fb58901ec in BLI_task_pool_work_and_wait /home/i74700deb64/blender/__work__/src/source/blender/blenlib/intern/task.c:670
    #16 0x564fb5016723 in scene_update_objects /home/i74700deb64/blender/__work__/src/source/blender/blenkernel/intern/scene.c:1671
    #17 0x564fb5016973 in scene_update_tagged_recursive /home/i74700deb64/blender/__work__/src/source/blender/blenkernel/intern/scene.c:1713
    #18 0x564fb50170ee in BKE_scene_update_tagged /home/i74700deb64/blender/__work__/src/source/blender/blenkernel/intern/scene.c:1816
    #19 0x564fb2cd86e6 in wm_event_do_notifiers /home/i74700deb64/blender/__work__/src/source/blender/windowmanager/intern/wm_event_system.c:404
    #20 0x564fb2cc6b56 in WM_main /home/i74700deb64/blender/__work__/src/source/blender/windowmanager/intern/wm.c:492
    #21 0x564fb2cbcf5a in main /home/i74700deb64/blender/__work__/src/source/creator/creator.c:527
    #22 0x7f8277a742b0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202b0)

previously allocated by thread T19 here:
    #0 0x7f82839c6ed0 in calloc (/usr/lib/x86_64-linux-gnu/libasan.so.3+0xc1ed0)
    #1 0x564fb5dae560 in MEM_lockfree_callocN /home/i74700deb64/blender/__work__/src/intern/guardedalloc/intern/mallocn_lockfree_impl.c:286
    #2 0x564fb4c6e1b3 in customData_add_layer__internal /home/i74700deb64/blender/__work__/src/source/blender/blenkernel/intern/customdata.c:1868
    #3 0x564fb4c6ee29 in CustomData_add_layer /home/i74700deb64/blender/__work__/src/source/blender/blenkernel/intern/customdata.c:1937
    #4 0x564fb4b1f29a in dm_getVertArray /home/i74700deb64/blender/__work__/src/source/blender/blenkernel/intern/DerivedMesh.c:107
    #5 0x564fb42f93d2 in surfacedeformModifier_do /home/i74700deb64/blender/__work__/src/source/blender/modifiers/intern/MOD_surfacedeform.c:1131
    #6 0x564fb42f94ee in deformVerts /home/i74700deb64/blender/__work__/src/source/blender/modifiers/intern/MOD_surfacedeform.c:1145
    #7 0x564fb4ea253c in modwrap_deformVerts /home/i74700deb64/blender/__work__/src/source/blender/blenkernel/intern/modifier.c:775
    #8 0x564fb4b2e927 in mesh_calc_modifiers /home/i74700deb64/blender/__work__/src/source/blender/blenkernel/intern/DerivedMesh.c:1985
    #9 0x564fb4b33ae8 in mesh_build_data /home/i74700deb64/blender/__work__/src/source/blender/blenkernel/intern/DerivedMesh.c:2628
    #10 0x564fb4b34596 in makeDerivedMesh /home/i74700deb64/blender/__work__/src/source/blender/blenkernel/intern/DerivedMesh.c:2725
    #11 0x564fb4f25f64 in BKE_object_handle_data_update /home/i74700deb64/blender/__work__/src/source/blender/blenkernel/intern/object_update.c:201
    #12 0x564fb4f0bf40 in BKE_object_handle_update_ex /home/i74700deb64/blender/__work__/src/source/blender/blenkernel/intern/object.c:2640
    #13 0x564fb5015e5b in scene_update_object_func /home/i74700deb64/blender/__work__/src/source/blender/blenkernel/intern/scene.c:1507
    #14 0x564fb588e9a2 in task_scheduler_thread_run /home/i74700deb64/blender/__work__/src/source/blender/blenlib/intern/task.c:326
    #15 0x7f8281900423 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x7423)

Thread T19 created by T0 here:
    #0 0x7f8283935f59 in __interceptor_pthread_create (/usr/lib/x86_64-linux-gnu/libasan.so.3+0x30f59)
    #1 0x564fb588edef in BLI_task_scheduler_create /home/i74700deb64/blender/__work__/src/source/blender/blenlib/intern/task.c:377
    #2 0x564fb5891e58 in BLI_task_scheduler_get /home/i74700deb64/blender/__work__/src/source/blender/blenlib/intern/threads.c:176
    #3 0x564fb5016570 in scene_update_objects /home/i74700deb64/blender/__work__/src/source/blender/blenkernel/intern/scene.c:1632
    #4 0x564fb5016973 in scene_update_tagged_recursive /home/i74700deb64/blender/__work__/src/source/blender/blenkernel/intern/scene.c:1713
    #5 0x564fb50170ee in BKE_scene_update_tagged /home/i74700deb64/blender/__work__/src/source/blender/blenkernel/intern/scene.c:1816
    #6 0x564fb555f9eb in rna_Scene_update_tagged /home/i74700deb64/blender/__work__/src/source/blender/makesrna/intern/rna_scene_api.c:130
    #7 0x564fb559de7d in Scene_update_call /home/i74700deb64/blender/__work__/build_cmake_dbg/source/blender/makesrna/intern/rna_scene_gen.c:11116
    #8 0x564fb5246a82 in RNA_function_call /home/i74700deb64/blender/__work__/src/source/blender/makesrna/intern/rna_access.c:6230
    #9 0x564fb3e91bfc in pyrna_func_call /home/i74700deb64/blender/__work__/src/source/blender/python/intern/bpy_rna.c:5551
    #10 0x7f8282d4d9a6 in PyObject_Call (/usr/lib/x86_64-linux-gnu/libpython3.5m.so.1.0+0x1d39a6)

@Bastien Montagne (mont29), there are other modifiers which had similar problem. The solution was to get a "persistent" copy of the arrays. This happens in MOD_boolean_util.c:dm_arrays_get() and also in BKE_bvhutils.h.