Sculpt Dyntopo undo crash #55336

Closed
opened 2018-06-05 15:14:49 +02:00 by Julien Kaspar · 14 comments
Member

Blender Version
Broken: 2.8 2891fb645b9

Short description of error
When using undo after sculpting with any brush with dyntopo turned on, Blender crashes.

**Blender Version** Broken: 2.8 2891fb645b9 **Short description of error** When using undo after sculpting with any brush with dyntopo turned on, Blender crashes.
Author
Member

Added subscriber: @JulienKaspar

Added subscriber: @JulienKaspar

blender/blender#58102 was marked as duplicate of this issue

blender/blender#58102 was marked as duplicate of this issue

Added subscriber: @klowner

Added subscriber: @klowner

I was digging into this a little today but couldn't quite determine how to fix the issue.

Here's an address-sanitizer dump of the crash:
https://gist.github.com/Klowner/dcb1155008452762be26e698d09cbbba

It looks like sculpt_pbvh_clear() frees the Object's ob->sculpt->pbvh, but then then the draw_manager_* stuff still has a pointer to the freed pbvh and attempts to read from it.

I was digging into this a little today but couldn't quite determine how to fix the issue. Here's an address-sanitizer dump of the crash: https://gist.github.com/Klowner/dcb1155008452762be26e698d09cbbba It looks like `sculpt_pbvh_clear()` frees the Object's `ob->sculpt->pbvh`, but then then the `draw_manager_*` stuff still has a pointer to the freed `pbvh` and attempts to read from it.
Campbell Barton was assigned by Dalai Felinto 2018-06-07 12:46:48 +02:00

The problem here is internally there are two undo timelines of undo history that get out of sync.


I've committed a fix for the common case that fails: - simple double free, and missing cow update: blender/blender@6242940639, blender/blender@d9d3e7778c.

However issues remain:

  • Files loaded with Dyntopo enabled have a crash when undoing back to the beginning (then painting).
  • With undo/redo and mode switching I managed to cause an assert: BLI_assert(!"Cannot drop BMLogEntry from middle");.

So I'd like to keep this open since the way undo and sculpt mode bmesh log should be made to work more reliably.

The problem here is internally there are two undo timelines of undo history that get out of sync. ---- I've committed a fix for the common case that fails: - simple double free, and missing cow update: blender/blender@6242940639, blender/blender@d9d3e7778c. However issues remain: - Files loaded with Dyntopo enabled have a crash when undoing back to the beginning (then painting). - With undo/redo and mode switching I managed to cause an assert: `BLI_assert(!"Cannot drop BMLogEntry from middle");`. So I'd like to keep this open since the way undo and sculpt mode bmesh log should be made to work more reliably.

Added subscriber: @Pik-1

Added subscriber: @Pik-1

I can confirm the bug. It happens systematically to me when following these steps:

  • turn on dyntopo
  • sculpt with any brush
  • press CTRL-Z
  • do one more stroke

Last tested revision: blender/blender@1d4ad68198

Stacktrace and error:

bin/blender(BLI_system_backtrace+0x26) [0x563fb74e6d80]
bin/blender(BM_log_entry_drop+0x147) [0x563fb6b92ef4]
bin/blender(+0x234ea14) [0x563fb6892a14]
bin/blender(+0x23511f9) [0x563fb68951f9]
bin/blender(+0x2cb52bd) [0x563fb71f92bd]
bin/blender(BKE_undosys_step_push_with_type+0xd5) [0x563fb71fa207]
bin/blender(BKE_undosys_step_push+0xbf) [0x563fb71fa558]
bin/blender(sculpt_undo_push_end+0x9c) [0x563fb689505c]
bin/blender(+0x234a28b) [0x563fb688e28b]
bin/blender(+0x231772c) [0x563fb685b72c]
bin/blender(paint_stroke_modal+0x465) [0x563fb685ca37]
bin/blender(+0x1d1a9df) [0x563fb625e9df]
bin/blender(+0x1d1c2e1) [0x563fb62602e1]
bin/blender(+0x1d1c3e3) [0x563fb62603e3]
bin/blender(wm_event_do_handlers+0x5f4) [0x563fb62616bc]
bin/blender(WM_main+0x30) [0x563fb625690d]
bin/blender(+0x1d0d640) [0x563fb6251640]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xe7) [0x7f443f82cb17]
bin/blender(_start+0x2a) [0x563fb6250fda]
BLI_assert failed: /home/bastien/logiciels/blender/blender/source/blender/bmesh/intern/bmesh_log.c:744, BM_log_entry_drop(), at '!"Cannot drop BMLogEntry from middle"'

System information:

  • Debian GNU/Linux (current Sid)
  • Acer Aspire V Nitro
  • NVIDIA Corporation GM107M [GeForce GTX 960M] (rev ff)
  • happens whether I run blender through optirun or not
I can confirm the bug. It happens systematically to me when following these steps: - turn on dyntopo - sculpt with any brush - press CTRL-Z - do one more stroke Last tested revision: blender/blender@1d4ad68198 Stacktrace and error: ``` bin/blender(BLI_system_backtrace+0x26) [0x563fb74e6d80] bin/blender(BM_log_entry_drop+0x147) [0x563fb6b92ef4] bin/blender(+0x234ea14) [0x563fb6892a14] bin/blender(+0x23511f9) [0x563fb68951f9] bin/blender(+0x2cb52bd) [0x563fb71f92bd] bin/blender(BKE_undosys_step_push_with_type+0xd5) [0x563fb71fa207] bin/blender(BKE_undosys_step_push+0xbf) [0x563fb71fa558] bin/blender(sculpt_undo_push_end+0x9c) [0x563fb689505c] bin/blender(+0x234a28b) [0x563fb688e28b] bin/blender(+0x231772c) [0x563fb685b72c] bin/blender(paint_stroke_modal+0x465) [0x563fb685ca37] bin/blender(+0x1d1a9df) [0x563fb625e9df] bin/blender(+0x1d1c2e1) [0x563fb62602e1] bin/blender(+0x1d1c3e3) [0x563fb62603e3] bin/blender(wm_event_do_handlers+0x5f4) [0x563fb62616bc] bin/blender(WM_main+0x30) [0x563fb625690d] bin/blender(+0x1d0d640) [0x563fb6251640] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xe7) [0x7f443f82cb17] bin/blender(_start+0x2a) [0x563fb6250fda] BLI_assert failed: /home/bastien/logiciels/blender/blender/source/blender/bmesh/intern/bmesh_log.c:744, BM_log_entry_drop(), at '!"Cannot drop BMLogEntry from middle"' ``` System information: - Debian GNU/Linux (current Sid) - Acer Aspire V Nitro - NVIDIA Corporation GM107M [GeForce GTX 960M] (rev ff) - happens whether I run blender through optirun or not

Added subscribers: @eoinoneill, @lichtwerk

Added subscribers: @eoinoneill, @lichtwerk

Did a completely clean build today (rebuilt the dependencies and everything), the issue seems to be gone.
Revision blender/blender@11f2c65128

Did a completely clean build today (rebuilt the dependencies and everything), the issue seems to be gone. Revision blender/blender@11f2c65128

Added subscriber: @jeacom

Added subscriber: @jeacom

Hey, I wanna make a patch and submit for review but this problem is happening when I try to build blender for debugging.
I wanna make some changes to sculpt.c, should I just ignore or it can cause problems?

Hey, I wanna make a patch and submit for review but this problem is happening when I try to build blender for debugging. I wanna make some changes to sculpt.c, should I just ignore or it can cause problems?

This issue was referenced by blender/blender@f87b93a567

This issue was referenced by blender/blender@f87b93a567fa86ffe784506a1648e4828cfe6272

This issue was referenced by blender/blender@06d1c2f737

This issue was referenced by blender/blender@06d1c2f7373d3b506675dd671661be26bc50704f

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
Sign in to join this conversation.
No Milestone
No project
No Assignees
7 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: studio/blender-studio#55336
No description provided.