Page MenuHome

GPencil: deleting interpolated frames causes crash
Closed, ResolvedPublic

Description

System Information
Operating system: Windows-7-6.1.7601-SP1 64 Bits
Graphics card: AMD Radeon HD 5700 Series ATI Technologies Inc. 4.5.13417 Core Profile Context 15.301.1901.0

Blender Version
Broken: version: 2.81 (sub 16), branch: master, commit date: 2019-11-20 14:27, hash: rB26bd5ebd42e3
I've tested 2.8 and 2.82 alpha, both crash as well

Short description of error
Deleting one of a few specific grease pencil frames created by "Interpolate Sequence" reliably crashes Blender. Deleting a shape in the frame also produces the same result.

I've had this happen once or twice before, but I never paid it much mind since it seemed random. Here's a file where it happens rather predictably, however.

Exact steps for others to reproduce the error

  1. Download the file attached.
  2. In the timeline, go to the area between 30 and 40.
  3. A) Delete frame 35, and other frames around it until Blender crashes. On my system, this happens anywhere between the first and the third frame deleted. B) or delete all the frames between 30 and 40. Blender should crash. D) or delete strokes or points on the layer "muzzle_f" on the frames between 30 and 40, starting with 35. On my system, Blender crashes within deleting the content of two frames.

Details

Type
Bug

Event Timeline

Antonio Vazquez (antoniov) lowered the priority of this task from Needs Triage by Developer to Needs Information from User.Thu, Nov 28, 7:19 PM

I have deleted all frames from 30 to 40 and my system doesn't crash.

Do you have any log of the crash?

I have deleted all frames from 30 to 40 and my system doesn't crash.
Do you have any log of the crash?

The kind of log produced by the following instructions?

When run normally, the console produces this error on crash:

Error   : EXCEPTION_ACCESS_VIOLATION
Address : 0x00000000774AA1FF
Module  : C:\Windows\SYSTEM32\ntdll.dll

If I run blender.exe --debug the console gives these errors instead...

Memoryblock free: pointer not in memlist
Memoryblock free: pointer not in memlist
Memoryblock free: pointer not in memlist

... for the most part, but a crash has also occured, giving the ACCESS_VIOLATION error above.

One information I forgot in my initial post: I'm using a portable version of Blender, maybe that has something to do with it.

Antonio Vazquez (antoniov) renamed this task from Grease Pencil: deleting interpolated frames causes crash to GPencil: deleting interpolated frames causes crash.Fri, Nov 29, 10:54 AM
Philipp Oeser (lichtwerk) raised the priority of this task from Needs Information from User to Confirmed, Medium.Fri, Nov 29, 10:56 AM

Yes, can reproduce. What I did:

  • open the file
  • zoom into the timeline a bit to see range around frame 35 better
  • move playhead to frame 35
  • select frame 35, X > Delete Keyframes
  • select frame 36, X > Delete Keyframes
  • select frame 37, X > Delete Keyframes

Doesnt seem to crash in the same places, a bit weird, maybe we should check with ASAN as well?
It is totaly reliable crash, had a couple of sessions [some of which survived without crash], but here are the backtraces of two sessions where it crashed:

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    1304 0x818f4f7 
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  0x818ec97 
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           1548 0x818e05b 
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_erase            hashtable.h           1906 0x818d778 
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>>::erase               hashtable.h           772  0x818d365 
6   std::unordered_set<GPUBatch *>::erase                                                                                                                                                                                                                                                                                                  unordered_set.h       545  0x818cdc1 
7   gpu_context_remove_batch                                                                                                                                                                                                                                                                                                               gpu_context.cpp       305  0x818c5e8 
8   GPU_batch_vao_cache_clear                                                                                                                                                                                                                                                                                                              gpu_batch.c           81   0x817e805 
9   GPU_batch_clear                                                                                                                                                                                                                                                                                                                        gpu_batch.c           144  0x817ea68 
10  GPU_batch_discard                                                                                                                                                                                                                                                                                                                      gpu_batch.c           154  0x817eac0 
11  gpencil_batch_cache_clear                                                                                                                                                                                                                                                                                                              gpencil_cache_utils.c 285  0x380bd23 
12  gpencil_batch_cache_get                                                                                                                                                                                                                                                                                                                gpencil_cache_utils.c 315  0x380c08d 
13  gpencil_populate_datablock                                                                                                                                                                                                                                                                                                             gpencil_draw_utils.c  2097 0x385bbdc 
14  gpencil_add_draw_data                                                                                                                                                                                                                                                                                                                  gpencil_engine.c      662  0x380dffa 
15  GPENCIL_cache_populate                                                                                                                                                                                                                                                                                                                 gpencil_engine.c      725  0x380e29c 
16  drw_engines_cache_populate                                                                                                                                                                                                                                                                                                             draw_manager.c        1145 0x37aa3c7 
17  DRW_draw_render_loop_ex                                                                                                                                                                                                                                                                                                                draw_manager.c        1659 0x37ab7ee 
18  DRW_draw_view                                                                                                                                                                                                                                                                                                                          draw_manager.c        1575 0x37ab3c5 
19  view3d_draw_view                                                                                                                                                                                                                                                                                                                       view3d_draw.c         1539 0x3f3e00a 
20  view3d_main_region_draw                                                                                                                                                                                                                                                                                                                view3d_draw.c         1563 0x3f3e0af 
... <More>
1   std::equal_to<GPUBatch *>::operator()                                                                                                                                                                                                                                                                                                      stl_function.h     356  0x818f939 
2   std::__detail::_Equal_helper<GPUBatch *, GPUBatch *, std::__detail::_Identity, std::equal_to<GPUBatch *>, unsigned long, false>::_S_equals                                                                                                                                                                                                 hashtable_policy.h 1461 0x818f463 
3   std::__detail::_Hashtable_base<GPUBatch *, GPUBatch *, std::__detail::_Identity, std::equal_to<GPUBatch *>, std::hash<GPUBatch *>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Hashtable_traits<false, true, true>>::_M_equals                                                                 hashtable_policy.h 1834 0x818ec64 
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_before_node     hashtable.h        1545 0x818e027 
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_find_node            hashtable.h        655  0x818ddf8 
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>>::_M_emplace<GPUBatch *&> hashtable.h        1652 0x818d65d 
7   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  0x818d340 
8   std::unordered_set<GPUBatch *>::emplace<GPUBatch *&>                                                                                                                                                                                                                                                                                       unordered_set.h    377  0x818cd96 
9   gpu_context_add_batch                                                                                                                                                                                                                                                                                                                      gpu_context.cpp    297  0x818c544 
10  batch_vao_get                                                                                                                                                                                                                                                                                                                              gpu_batch.c        259  0x817ee7a 
11  GPU_batch_program_set_no_use                                                                                                                                                                                                                                                                                                               gpu_batch.c        346  0x817f23e 
12  GPU_batch_program_set                                                                                                                                                                                                                                                                                                                      gpu_batch.c        351  0x817f270 
13  GPU_batch_program_set_builtin_with_config                                                                                                                                                                                                                                                                                                  gpu_batch.c        936  0x8180b08 
14  GPU_batch_program_set_builtin                                                                                                                                                                                                                                                                                                              gpu_batch.c        941  0x8180b30 
15  ED_screen_draw_edges                                                                                                                                                                                                                                                                                                                       screen_draw.c      420  0x3c75156 
16  wm_draw_window_onscreen                                                                                                                                                                                                                                                                                                                    wm_draw.c          735  0x32ded66 
17  wm_draw_window                                                                                                                                                                                                                                                                                                                             wm_draw.c          768  0x32dee70 
18  wm_draw_update                                                                                                                                                                                                                                                                                                                             wm_draw.c          945  0x32df425 
19  WM_main                                                                                                                                                                                                                                                                                                                                    wm.c               423  0x32db296 
20  main                                                                                                                                                                                                                                                                                                                                       creator.c          496  0x2d117b6 
... <More>

@Lionel Fiévet (Nelfie) Did you noticed if this is only for interpolated frames? never had the same issue with hand draw frames?

@Philipp Oeser (lichtwerk) I have seen there is a problem whith weight free memory...if you look at the console, you will see a "Couldn't unmap memory". I guess there must be an issue when interpolate frames and the weights are not created as expected (almost sure, the weights arry is not initializated propertly).

@Lionel Fiévet (Nelfie) Did you noticed if this is only for interpolated frames? never had the same issue with hand draw frames?

I can't tell for sure. I use interpolation a lot - and they're the frames I delete most often, in large groups, since they need to be re-done whenever I modify a key.
I'll keep track of it if the same bug occurs again and let you know. (As long as it's relevant to fixing the problem, of course)

@Philipp Oeser (lichtwerk) I have submitted 1321be0af9f6 and I think this was the reason of the error. Could you recompile and try again?

Really, the problem was not in the frame delete process, but in how the interpolated sequence frames were created. The problem was when the number of points of the destination stroke were less than original stroke and the weights array had to be resized. By a mistake, it was resizing the original stroke instead of the new interpolated stroke, and this corrupted the pointers... and after that corruption, anything can fail.

@Lionel Fiévet (Nelfie) Can you reproduce the bug with the last buildbot? You must check with anew file...the old file already damaged can fail.

@Lionel Fiévet (Nelfie) Can you reproduce the bug with the last buildbot? You must check with anew file...the old file already damaged can fail.

I'll try as soon as possible.
I assume I should reproduce the specific situation you described in the previous comment, yes? Also, is a single file enough, or should I make multiple in case the bug is random?

@Lionel Fiévet (Nelfie) Yes, just create a new file and try to reproduced the steps to create the bug. I hope the fix avoids the error you had in your file.

@Lionel Fiévet (Nelfie) Yes, just create a new file and try to reproduced the steps to create the bug. I hope the fix avoids the error you had in your file.

So, I tried to reproduce the bug in 2.81 first, to make sure I was going through the right steps - but I haven't managed to make the bug happen again. Here's what I did:

  1. New file -> 2D animation Template
  2. Create a shape on a frame
  3. Move to a later frame
  4. Either
    • A) Create a new shape with less points
    • B) Make a new key for the first shape, and delete/dissolve some points
  5. Apply Interpolate->Sequence between each frame
  6. Delete the in-betweens created by point 5

It doesn't cause a crash, so unless it's random, I'm missing something. Any ideas?

Try painting weights in the strokes before interpolate, but if my fix worked all must go fine.

Try painting weights in the strokes before interpolate, but if my fix worked all must go fine.

Ah, yes, that was it, thank you! I had forgotten I had added vertex groups in the original file.
I tested the bug with a new file in 2.81, and the crash occurred as predicted. Using the same file in the latest 2.82 alpha (saved without interpolations), I went through the same steps, and no crash occurred. Same for the reverse (file made and tested in 2.82 alpha, then saved and tested in 2.81.)
So, problem fixed as far as I can tell. Good work!

Antonio Vazquez (antoniov) closed this task as Resolved.Thu, Dec 5, 6:52 PM

Thanks @Lionel Fiévet (Nelfie) for your testing. I'm going to close the report. If you have more problems, please, open a new report.