"Add plane > align" causes crash when certain rigs are in the scene (2.83, fixed in 2.90) #77847

Closed
opened 2020-06-13 23:53:55 +02:00 by Marcin Twarowski · 25 comments

System Information
Operating system: Windows-10-10.0.18362-SP0 64 Bits
Graphics card: GeForce GTX 750 Ti/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 446.14

Blender Version
Broken: version: 2.83.0, branch: master, commit date: 2020-06-03 14:38, hash: 211b6c29f7

Short description of error
I can't simplify the scene anymore. Deleting anything more fixes the crash. There are two rigs - rigify and camera rig. There's a rigify script and some leftover copies of it. In this particular example allowing rigify script to run seems to prevent the crash, but in my original project it doesn't matter if the script is executed or not. It doesn't crash in 2.90, although there are other bugs there that I already reported.

Exact steps for others to reproduce the error

  • Open file:
    align_view_crash.blend
  • I have automatic execution of scripts disabled, so when prompted about rigify script I press ignore:
    image.png
  • Add Plane or UV Sphere or Ico Spehere (shift+a). Other types of meshes don't crash for some reason.
  • In the "Adjust last operation" window go to "Align" dropdown menu. Choosing any of the three options should crash Blender.
    blender_debug_output.txt
    It will not crash if you first change selection to other object. In my original project however it doesn't matter what's selected.
**System Information** Operating system: Windows-10-10.0.18362-SP0 64 Bits Graphics card: GeForce GTX 750 Ti/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 446.14 **Blender Version** Broken: version: 2.83.0, branch: master, commit date: 2020-06-03 14:38, hash: `211b6c29f7` **Short description of error** I can't simplify the scene anymore. Deleting anything more fixes the crash. There are two rigs - rigify and camera rig. There's a rigify script and some leftover copies of it. In this particular example allowing rigify script to run seems to prevent the crash, but in my original project it doesn't matter if the script is executed or not. It doesn't crash in 2.90, although there are other bugs there that I already reported. **Exact steps for others to reproduce the error** - Open file: [align_view_crash.blend](https://archive.blender.org/developer/F8616962/align_view_crash.blend) - I have automatic execution of scripts disabled, so when prompted about rigify script I press ignore: ![image.png](https://archive.blender.org/developer/F8616855/image.png) - Add Plane or UV Sphere or Ico Spehere (shift+a). Other types of meshes don't crash for some reason. - In the "Adjust last operation" window go to "Align" dropdown menu. Choosing any of the three options should crash Blender. [blender_debug_output.txt](https://archive.blender.org/developer/F8616968/blender_debug_output.txt) It will not crash if you first change selection to other object. In my original project however it doesn't matter what's selected.

Added subscriber: @MarcinTwarowski

Added subscriber: @MarcinTwarowski

#79383 was marked as duplicate of this issue

#79383 was marked as duplicate of this issue

#79598 was marked as duplicate of this issue

#79598 was marked as duplicate of this issue
Member

Added subscriber: @lichtwerk

Added subscriber: @lichtwerk
Member

Changed status from 'Needs Triage' to: 'Needs User Info'

Changed status from 'Needs Triage' to: 'Needs User Info'
Member

Hm, no crash here (tried 2.83 and 9f5cc128d9).

Just to make sure: does this hapen with Factory Defaults as well?

Hm, no crash here (tried 2.83 and 9f5cc128d9). Just to make sure: does this hapen with Factory Defaults as well?

When I load factory settings it crashes too, but not every time. When I run debug .cmd files, then it seems to crash more often:
blender_system_info.txt
blender_debug_output.txt

When I load factory settings it crashes too, but not every time. When I run debug .cmd files, then it seems to crash more often: [blender_system_info.txt](https://archive.blender.org/developer/F8622594/blender_system_info.txt) [blender_debug_output.txt](https://archive.blender.org/developer/F8622593/blender_debug_output.txt)

I managed to reproduce the problem on a different Windows machine, although it does seem to happen at random:
blender_system_info.txt
blender_debug_output.txt

I managed to reproduce the problem on a different Windows machine, although it does seem to happen at random: [blender_system_info.txt](https://archive.blender.org/developer/F8624374/blender_system_info.txt) [blender_debug_output.txt](https://archive.blender.org/developer/F8624373/blender_debug_output.txt)
Member

Changed status from 'Needs User Info' to: 'Needs Triage'

Changed status from 'Needs User Info' to: 'Needs Triage'

Added subscriber: @mano-wii

Added subscriber: @mano-wii

Changed status from 'Needs Triage' to: 'Needs User Info'

Changed status from 'Needs Triage' to: 'Needs User Info'

I cannot reproduce this with either the latest stable or current development versions of Blender.

I tested with Plane, UV Sphere and Ico Sphere and tested all the alignment options.

Please try the latest daily build: https://builder.blender.org/download/

Go to File → Defaults → Load Factory Settings and then load your file to see if you still can reproduce this issue.

If the problem persists, please give us more clear instructions on how to reproduce it from scratch.

I cannot reproduce this with either the latest stable or current development versions of Blender. I tested with `Plane`,` UV Sphere` and `Ico Sphere` and tested all the alignment options. Please try the latest daily build: https://builder.blender.org/download/ Go to File → Defaults → Load Factory Settings and then load your file to see if you still can reproduce this issue. If the problem persists, please give us more clear instructions on how to reproduce it from scratch.

As I wrote, it doesn't happen in 2.90. In 2.83.1 best way to reproduce it for me is to use debug modes. Then it crashes 100% times:

blender_align_view_crash.mp4

EDIT:
Just tested on 2.83.2 and it's the same.

Here's a different test with the same file and 2.90 3623db7784 (on a different Windows 10 machine). Reopening the file quickly will crash Blender, but that could be a different bug altogether:

blender_290_crash.mp4

As I wrote, it doesn't happen in 2.90. In 2.83.1 best way to reproduce it for me is to use debug modes. Then it crashes 100% times: [blender_align_view_crash.mp4](https://archive.blender.org/developer/F8678776/blender_align_view_crash.mp4) EDIT: Just tested on 2.83.2 and it's the same. Here's a different test with the same file and **2.90 3623db7784b3** (on a different Windows 10 machine). Reopening the file quickly will crash Blender, but that could be a different bug altogether: [blender_290_crash.mp4](https://archive.blender.org/developer/F8683665/blender_290_crash.mp4)

Changed status from 'Needs User Info' to: 'Needs Triage'

Changed status from 'Needs User Info' to: 'Needs Triage'

Added subscribers: @mont29, @ideasman42

Added subscribers: @mont29, @ideasman42

I managed to redo a crash with align_view_crash.blend

switching view types, although it crashed when switching to the "3D cursor" in my case.

This is the ASAN output: asan_T77847.txt

@mont29, this looks to be an issue in memfile undo/redo, are you aware which change in 2.90x that would have fixed this?

I managed to redo a crash with [align_view_crash.blend](https://archive.blender.org/developer/F8616962/align_view_crash.blend) switching view types, although it crashed when switching to the "3D cursor" in my case. This is the ASAN output: [asan_T77847.txt](https://archive.blender.org/developer/F8747229/asan_T77847.txt) @mont29, this looks to be an issue in memfile undo/redo, are you aware which change in 2.90x that would have fixed this?
Campbell Barton changed title from "Add plane > align" causes crash when certain rigs are in the scene to "Add plane > align" causes crash when certain rigs are in the scene (2.83, fixed in 2.90) 2020-08-05 07:25:27 +02:00

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'

Added subscribers: @dr.sybren, @brecht

Added subscribers: @dr.sybren, @brecht

Fwiw, bisect shows cda1540858 "fixes" the issue... basically by avoiding a lot of useless re-reading (so it actually rather hides it).

In any case, it's again those horrible bone pointers in pose data, crash happens when storing an undo step with dirty pose data needing to be rebuilt. That very ugly quickpatch (based on cda1540858) fixes it for me:

diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index e3b4166a4bf..31e80b9d260 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -151,6 +151,7 @@
 #include "MEM_guardedalloc.h"  // MEM_freeN
 
 #include "BKE_action.h"
+#include "BKE_armature.h"
 - include "BKE_blender_version.h"
 - include "BKE_bpath.h"
 #include "BKE_collection.h"
@@ -4214,9 +4215,14 @@ static bool write_file_handle(Main *mainvar,
           case ID_AC:
             write_action(wd, (bAction *)id_buffer, id);
             break;
-          case ID_OB:
+          case ID_OB: {
+            Object *object = (Object *)id_buffer;
+            if (object->pose != NULL && (object->pose->flag & POSE_RECALC) != 0) {
+              BKE_pose_rebuild(mainvar, object, object->data, true);
+            }
             write_object(wd, (Object *)id_buffer, id);
             break;
+          }
           case ID_MA:
             write_material(wd, (Material *)id_buffer, id);
             break;

But I would rather avoid such horror... We could also maybe just call BKE_pose_clear_pointers() instead ? Not sure how the read code would react to that though...
I wonder if we should not rather just systematically re-build from scratch pose data in readcode? Would be the safest way to deal with those issues imho.

@brecht, @dr.sybren, any thoughts on this?

Fwiw, bisect shows cda1540858 "fixes" the issue... basically by avoiding a lot of useless re-reading (so it actually rather hides it). In any case, it's again those horrible bone pointers in pose data, crash happens when storing an undo step with dirty pose data needing to be rebuilt. That very ugly quickpatch (based on cda1540858) fixes it for me: ``` diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index e3b4166a4bf..31e80b9d260 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -151,6 +151,7 @@ #include "MEM_guardedalloc.h" // MEM_freeN #include "BKE_action.h" +#include "BKE_armature.h" - include "BKE_blender_version.h" - include "BKE_bpath.h" #include "BKE_collection.h" @@ -4214,9 +4215,14 @@ static bool write_file_handle(Main *mainvar, case ID_AC: write_action(wd, (bAction *)id_buffer, id); break; - case ID_OB: + case ID_OB: { + Object *object = (Object *)id_buffer; + if (object->pose != NULL && (object->pose->flag & POSE_RECALC) != 0) { + BKE_pose_rebuild(mainvar, object, object->data, true); + } write_object(wd, (Object *)id_buffer, id); break; + } case ID_MA: write_material(wd, (Material *)id_buffer, id); break; ``` But I would rather avoid such horror... We could also maybe just call `BKE_pose_clear_pointers()` instead ? Not sure how the read code would react to that though... I wonder if we should not rather just systematically re-build from scratch pose data in readcode? Would be the safest way to deal with those issues imho. @brecht, @dr.sybren, any thoughts on this?

lib_link_pose already has code for rebuilding the pose and looking up the bone pointers again? If that works correctly there should be no invalid bone pointers after file load.

From what I understand it's this code that is crashing, and it's the only code that is accessing the bone pointer in the file writing code.

    /* prevent crashes with autosave,
     * when a bone duplicated in editmode has not yet been assigned to its posechannel */
    if (chan->bone) {
      /* gets restored on read, for library armatures */
      chan->selectflag = chan->bone->flag & BONE_SELECTED;
    }

BKE_pose_clear_pointers would disable this code, then we might as well remove it.

Something like this I guess will work. Preserving selection here seems important, and I don't immediately have a better solution.

Bone *bone = (pose->flag & POSE_RECALC) ? BKE_armature_find_bone_name(arm, pchan->name) : pchan->bone;
if (bone) {
   chan->selectflag = bone->flag & BONE_SELECTED;
}
`lib_link_pose` already has code for rebuilding the pose and looking up the bone pointers again? If that works correctly there should be no invalid bone pointers after file load. From what I understand it's this code that is crashing, and it's the only code that is accessing the bone pointer in the file writing code. ``` /* prevent crashes with autosave, * when a bone duplicated in editmode has not yet been assigned to its posechannel */ if (chan->bone) { /* gets restored on read, for library armatures */ chan->selectflag = chan->bone->flag & BONE_SELECTED; } ``` `BKE_pose_clear_pointers` would disable this code, then we might as well remove it. Something like this I guess will work. Preserving selection here seems important, and I don't immediately have a better solution. ``` Bone *bone = (pose->flag & POSE_RECALC) ? BKE_armature_find_bone_name(arm, pchan->name) : pchan->bone; if (bone) { chan->selectflag = bone->flag & BONE_SELECTED; } ```
Member

Added subscriber: @cameroni101

Added subscriber: @cameroni101
Member

Added subscriber: @arb65912

Added subscriber: @arb65912

This issue was referenced by 112416e4fb

This issue was referenced by 112416e4fb8ca85b6a2fa3d619eddd18b62ab0c2

This issue was referenced by ab2dbafd8b

This issue was referenced by ab2dbafd8b6263d85c86c83279f9f3e067b4f7e5

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Bastien Montagne self-assigned this 2020-08-10 14:37:32 +02:00
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
8 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: blender/blender#77847
No description provided.