Crash after any alembic import undo in an empty scene #77754

Closed
opened 3 years ago by YegorSmirnov · 17 comments

System Information
Operating system: Linux-3.10.0-1062.9.1.el7.x86_64-x86_64-with-centos-7.7.1908-Core 64 Bits
Graphics card: GeForce GTX 1070/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 440.44

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

Short description of error
The bug appears only on an empty scene after importing an alembic and undo.Crash after any alembic import, then immediately undo without any other steps

Exact steps for others to reproduce the error
#77754.abc

  • Open Blender and delete all the objects if there are any
  • import .abc
  • no other steps
  • undo --> crash
**System Information** Operating system: Linux-3.10.0-1062.9.1.el7.x86_64-x86_64-with-centos-7.7.1908-Core 64 Bits Graphics card: GeForce GTX 1070/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 440.44 **Blender Version** Broken: version: 2.83.0, branch: master, commit date: 2020-06-03 14:38, hash: `211b6c29f7` **Short description of error** The bug appears only on an empty scene after importing an alembic and undo.Crash after any alembic import, then immediately undo without any other steps **Exact steps for others to reproduce the error** [#77754.abc](https://archive.blender.org/developer/F8608021/T77754.abc) - Open Blender and delete all the objects if there are any - import .abc - no other steps - undo --> crash
Poster

Added subscriber: @YegorSmirnov

Added subscriber: @YegorSmirnov
Collaborator

Added subscriber: @lichtwerk

Added subscriber: @lichtwerk
Collaborator

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

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

Can confirm.

Can confirm.
lichtwerk changed title from Crash after any alembic import undo in an empty scene to Crash after any alembic import undo 3 years ago
Collaborator

Added subscriber: @dr.sybren

Added subscriber: @dr.sybren
Collaborator

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
dr.sybren closed this issue 3 years ago
dr.sybren self-assigned this 3 years ago
Collaborator

@lichtwerk reproduced this bug, but I can't reproduce it with the latest official release (2.83) or with the latest daily build (2.90 2797a63a66). so it appears the bug has been fixed already.

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

If the problem persists, please let us know so we can re-open the report. Don't forget to mention the specific version you tested again.

@lichtwerk reproduced this bug, but I can't reproduce it with the latest official release (2.83) or with the latest daily build (2.90 2797a63a66). so it appears the bug has been fixed already. Please try the latest daily build: https://builder.blender.org/download/ If the problem persists, please let us know so we can re-open the report. Don't forget to mention the specific version you tested again.
Collaborator

Changed status from 'Resolved' to: 'Confirmed'

Changed status from 'Resolved' to: 'Confirmed'
lichtwerk reopened this issue 3 years ago
Collaborator

I can still repro with todays buildbot and 2.83 release.

God only knows why I was able to reproduce this in a non-empty scene (and why I have updated the report description and title), sorry for the confusion!
This only happens in an empty scene (will update the report again)

I can still repro with todays buildbot and 2.83 release. God only knows why I was able to reproduce this in a non-empty scene (and why I have updated the report description and title), sorry for the confusion! **This only happens in an empty scene** (will update the report again)
lichtwerk changed title from Crash after any alembic import undo to Crash after any alembic import undo in an empty scene 3 years ago
dr.sybren removed their assignment 3 years ago
Collaborator

I still can't reproduce it, even on an empty scene.

@lichtwerk what platform are you testing on? I have Kubuntu Linux 19.10 (kernel 5.3.0), NVidia GTX 1080 (driver version 450.36.06).

Also, which version of Blender did still work properly?

I still can't reproduce it, even on an empty scene. @lichtwerk what platform are you testing on? I have Kubuntu Linux 19.10 (kernel 5.3.0), NVidia GTX 1080 (driver version 450.36.06). Also, which version of Blender did still work properly?
Poster

Just tested 2.90 from the buildbot and it still crashes on Mint and CenOS

Just tested 2.90 from the buildbot and it still crashes on Mint and CenOS
mont29 commented 3 years ago
Owner

Added subscriber: @mont29

Added subscriber: @mont29
mont29 self-assigned this 3 years ago
mont29 commented 3 years ago
Owner

This is related to Undo I think. Alembic and Collada import operators are not flagged for undo (!!!), will fix this now, but this is not enough to fix the crash.

This is related to Undo I think. Alembic and Collada import operators are not flagged for undo (!!!), will fix this now, but this is not enough to fix the crash.
mont29 removed their assignment 3 years ago
dr.sybren was assigned by mont29 3 years ago
mont29 commented 3 years ago
Owner

Well in fact issue is with alembic importer, which starts a background job for actual import, so undo step stored by the operator management system is done before data is actually changed, and importer had to do its own undo push when it is done.

This quick patch solves it, but not sure it's the best way to handle it (it add extra useless undo step e.g.), will let @dr.sybren handle it from there.

P1481: (An Untitled Masterwork)

diff --git a/source/blender/io/alembic/intern/alembic_capi.cc b/source/blender/io/alembic/intern/alembic_capi.cc
index 0b4b184359b..a406b63df06 100644
--- a/source/blender/io/alembic/intern/alembic_capi.cc
+++ b/source/blender/io/alembic/intern/alembic_capi.cc
@@ -51,6 +51,8 @@
 #include "DEG_depsgraph.h"
 #include "DEG_depsgraph_build.h"
 
+#include "ED_undo.h"
+
 /* SpaceType struct has a member called 'new' which obviously conflicts with C++
  * so temporarily redefining the new keyword to make it compile. */
 #define new extern_new
@@ -429,6 +431,7 @@ enum {
 };
 
 struct ImportJobData {
+  bContext *C;
   Main *bmain;
   Scene *scene;
   ViewLayer *view_layer;
@@ -447,6 +450,7 @@ struct ImportJobData {
   char error_code;
   bool was_cancelled;
   bool import_ok;
+  bool is_background_job;
 };
 
 static void import_startjob(void *user_data, short *stop, short *do_update, float *progress)
@@ -630,6 +634,12 @@ static void import_endjob(void *user_data)
 
     DEG_id_tag_update(&data->scene->id, ID_RECALC_BASE_FLAGS);
     DEG_relations_tag_update(data->bmain);
+
+    if (data->is_background_job) {
+      /* We already returned from the import operator, so we need to store our own extra undo step.
+       */
+      ED_undo_push(data->C, "Alembic Import Finished");
+    }
   }
 
   for (iter = data->readers.begin(); iter != data->readers.end(); ++iter) {
@@ -675,6 +685,7 @@ bool ABC_import(bContext *C,
 {
   /* Using new here since MEM_* functions do not call constructor to properly initialize data. */
   ImportJobData *job = new ImportJobData();
+  job->C = C;
   job->bmain = CTX_data_main(C);
   job->scene = CTX_data_scene(C);
   job->view_layer = CTX_data_view_layer(C);
@@ -691,6 +702,7 @@ bool ABC_import(bContext *C,
   job->error_code = ABC_NO_ERROR;
   job->was_cancelled = false;
   job->archive = NULL;
+  job->is_background_job = as_background_job;
 
   G.is_break = false;
 

Well in fact issue is with alembic importer, which starts a background job for actual import, so undo step stored by the operator management system is done before data is actually changed, and importer had to do its own undo push when it is done. This quick patch solves it, but not sure it's the best way to handle it (it add extra useless undo step e.g.), will let @dr.sybren handle it from there. [P1481: (An Untitled Masterwork)](https://archive.blender.org/developer/P1481.txt) ``` diff --git a/source/blender/io/alembic/intern/alembic_capi.cc b/source/blender/io/alembic/intern/alembic_capi.cc index 0b4b184359b..a406b63df06 100644 --- a/source/blender/io/alembic/intern/alembic_capi.cc +++ b/source/blender/io/alembic/intern/alembic_capi.cc @@ -51,6 +51,8 @@ #include "DEG_depsgraph.h" #include "DEG_depsgraph_build.h" +#include "ED_undo.h" + /* SpaceType struct has a member called 'new' which obviously conflicts with C++ * so temporarily redefining the new keyword to make it compile. */ #define new extern_new @@ -429,6 +431,7 @@ enum { }; struct ImportJobData { + bContext *C; Main *bmain; Scene *scene; ViewLayer *view_layer; @@ -447,6 +450,7 @@ struct ImportJobData { char error_code; bool was_cancelled; bool import_ok; + bool is_background_job; }; static void import_startjob(void *user_data, short *stop, short *do_update, float *progress) @@ -630,6 +634,12 @@ static void import_endjob(void *user_data) DEG_id_tag_update(&data->scene->id, ID_RECALC_BASE_FLAGS); DEG_relations_tag_update(data->bmain); + + if (data->is_background_job) { + /* We already returned from the import operator, so we need to store our own extra undo step. + */ + ED_undo_push(data->C, "Alembic Import Finished"); + } } for (iter = data->readers.begin(); iter != data->readers.end(); ++iter) { @@ -675,6 +685,7 @@ bool ABC_import(bContext *C, { /* Using new here since MEM_* functions do not call constructor to properly initialize data. */ ImportJobData *job = new ImportJobData(); + job->C = C; job->bmain = CTX_data_main(C); job->scene = CTX_data_scene(C); job->view_layer = CTX_data_view_layer(C); @@ -691,6 +702,7 @@ bool ABC_import(bContext *C, job->error_code = ABC_NO_ERROR; job->was_cancelled = false; job->archive = NULL; + job->is_background_job = as_background_job; G.is_break = false; ```
Owner

This issue was referenced by a2c1f41d95

This issue was referenced by a2c1f41d95957a84e7a856a7b1dc889a0d98be5b
Owner

This issue was referenced by 25d2222c30

This issue was referenced by 25d2222c302acd7278b49f30a74adba6b9457012
Collaborator

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
dr.sybren closed this issue 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
5 Participants
Notifications
Due Date

No due date set.

Dependencies

No dependencies set.

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