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

Closed
opened 3 years ago by MarcinTwarowski · 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.
Poster

Added subscriber: @MarcinTwarowski

Added subscriber: @MarcinTwarowski
Owner

#79383 was marked as duplicate of this issue

#79383 was marked as duplicate of this issue
Owner

#79598 was marked as duplicate of this issue

#79598 was marked as duplicate of this issue
Collaborator

Added subscriber: @lichtwerk

Added subscriber: @lichtwerk
Collaborator

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

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

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?
Poster

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)
Poster

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)
Collaborator

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

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

Added subscriber: @mano-wii

Added subscriber: @mano-wii
Collaborator

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

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

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.
Poster

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)
rjg commented 3 years ago
Collaborator

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

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

Added subscribers: @mont29, @ideasman42

Added subscribers: @mont29, @ideasman42
Owner

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?
ideasman42 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) 3 years ago
Owner

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

Changed status from 'Needs Triage' to: 'Confirmed'
mont29 commented 3 years ago
Owner

Added subscribers: @dr.sybren, @brecht

Added subscribers: @dr.sybren, @brecht
mont29 commented 3 years ago
Owner

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?
brecht commented 3 years ago
Owner

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; } ```
Collaborator

Added subscriber: @cameroni101

Added subscriber: @cameroni101
Collaborator

Added subscriber: @arb65912

Added subscriber: @arb65912
Owner

This issue was referenced by 112416e4fb

This issue was referenced by 112416e4fb8ca85b6a2fa3d619eddd18b62ab0c2
Owner

This issue was referenced by ab2dbafd8b

This issue was referenced by ab2dbafd8b6263d85c86c83279f9f3e067b4f7e5
mont29 commented 3 years ago
Owner

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
mont29 closed this issue 3 years ago
mont29 self-assigned this 3 years ago
Sign in to join this conversation.
No Label
good first issue
legacy module/Animation & Rigging
legacy module/Core
legacy module/Development Management
legacy module/Eevee & Viewport
legacy module/Grease Pencil
legacy module/Modeling
legacy module/Nodes & Physics
legacy module/Pipeline, Assets & IO
legacy module/Platforms, Builds, Tests & Devices
legacy module/Python API
legacy module/Rendering & Cycles
legacy module/Sculpt, Paint & Texture
legacy module/Triaging
legacy module/User Interface
legacy module/VFX & Video
legacy project/1.0.0-beta.2
legacy project/2.81
legacy project/2.82
legacy project/2.83
legacy project/2.90
legacy project/2.91
legacy project/2.92
legacy project/3.0
legacy project/3.1
legacy project/3.2
legacy project/3.3
legacy project/Alembic
legacy project/Animation & Rigging
legacy project/Asset Browser
legacy project/Asset Browser (Archived)
legacy project/Asset Browser Project Overview
legacy project/Audio
legacy project/Automated Testing
legacy project/BF Blender: 2.8
legacy project/BF Blender: After Release
legacy project/BF Blender: Next
legacy project/BF Blender: Regressions
legacy project/BF Blender: Unconfirmed
legacy project/Blender 2.70
legacy project/Blender Asset Bundle
legacy project/Code Quest
legacy project/Collada
legacy project/Compositing
legacy project/Core
legacy project/Cycles
legacy project/Datablocks and Libraries
legacy project/Dependency Graph
legacy project/Development Management
legacy project/Eevee
legacy project/EEVEE & Viewport
legacy project/Freestyle
legacy project/Game Animation
legacy project/Game Audio
legacy project/Game Data Conversion
legacy project/Game Engine
legacy project/Game Logic
legacy project/Game Physics
legacy project/Game Python
legacy project/Game Rendering
legacy project/Game UI
legacy project/Geometry Nodes
legacy project/Good First Issue
legacy project/GPU / Viewport
legacy project/Grease Pencil
legacy project/GSoC
legacy project/Images & Movies
legacy project/Import/Export
legacy project/Infrastructure: Websites
legacy project/LibOverrides - Usability and UX
legacy project/Line Art
legacy project/Masking
legacy project/Milestone 1: Basic, Local Asset Browser
legacy project/Modeling
legacy project/Modifiers
legacy project/Motion Tracking
legacy project/Nodes
legacy project/Nodes & Physics
legacy project/OpenGL Error
legacy project/Overrides
legacy project/Papercut
legacy project/Performance
legacy project/Physics
legacy project/Pipeline, Assets & I/O
legacy project/Platform: FreeBSD
legacy project/Platform: Linux
legacy project/Platform: macOS
legacy project/Platforms, Builds, Tests & Devices
legacy project/Platform: Windows
legacy project/Pose Library Basics
legacy project/Python API
legacy project/Render & Cycles
legacy project/Render Pipeline
legacy project/Retrospective
legacy project/Sculpt, Paint & Texture
legacy project/Text Editor
legacy project/Tracker Curfew
legacy project/Translations
legacy project/Triaging
legacy project/Undo
legacy project/USD
legacy project/User Interface
legacy project/UV Editing
legacy project/VFX & Video
legacy project/Video Sequencer
legacy project/Virtual Reality
legacy project/Wintab High Frequency
migration/requires-manual-verification
Module › Animation & Rigging
Module › Core
Module › Development Management
Module › Eevee & Viewport
Module › EEVEE & Viewport
Module › Grease Pencil
Module › Modeling
Module › Nodes & Physics
Module › Pipeline, Assets & IO
Module › Platforms, Builds Tests & Devices
Module › Platforms, Builds, Tests & Devices
Module › Python API
Module › Rendering & Cycles
Module › Sculpt, Paint & Texture
Module › Triaging
Module › User Interface
Module › VFX & Video
papercut
performance
Priority › High
Priority › Low
Priority › Normal
Priority › Unbreak Now!
Status › Archived
Status › Confirmed
Status › Duplicate
Status › Needs Information 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

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#77847
Loading…
There is no content yet.