Assets: the same catalog UUID appearing in different asset libraries causes failed assertions in the 'All' library #108624

Open
opened 2023-06-05 16:37:22 +02:00 by Sybren A. Stüvel · 1 comment

System Information
Operating system: Linux-5.15.0-73-generic-x86_64-with-glibc2.35 64 Bits, X11 UI
Graphics card: NVIDIA GeForce GTX 1080/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 470.182.03

Blender Version
Broken: version: 4.0.0 Alpha, branch: main, commit date: Mon Jun 5 14:21:39 2023 +0200, hash: c18ee2e84dcebaf5831640c987e5fd434219e46c
Worked: probably broken since the introduction of the 'All' library

Short description of error
Having two asset libraries that both have a catalog with the same UUID cause an error:

BLI_assert failed: blender/source/blender/blenlib/BLI_map.hh:1093, add_new__impl(), at '!this->contains_as(key)'

Exact steps for others to reproduce the error

  • Extract the attached ZIP file. It contains a blend file and two asset libraries.
  • Run Blender in debug mode.
  • Open the blend file.
  • Run the script in the text editor (which adds the two asset libraries to your preferences; don't worry, they won't be saved)
  • Refresh the 'All' asset catalog.
  • See the failed assertion

Workaround

Applying this patch will work around this issue:

diff --git a/source/blender/asset_system/intern/asset_catalog.cc b/source/blender/asset_system/intern/asset_catalog.cc
index d27763c08d7..8512824b6d4 100644
--- a/source/blender/asset_system/intern/asset_catalog.cc
+++ b/source/blender/asset_system/intern/asset_catalog.cc
@@ -686,7 +686,7 @@ static void copy_catalog_map_into_existing(const OwningAssetCatalogMap &source,
 {
   for (const auto &orig_catalog_uptr : source.values()) {
     auto copy_catalog_uptr = std::make_unique<AssetCatalog>(*orig_catalog_uptr);
-    dest.add_new(copy_catalog_uptr->catalog_id, std::move(copy_catalog_uptr));
+    dest.add(copy_catalog_uptr->catalog_id, std::move(copy_catalog_uptr));
   }
 }
 

A better solution would be to implement some comparison function like bool AssetCatalog::is_consistent_with(const AC &other); that tests both the UUID and the catalog path are identical, and issue a warning if they are not, similar to what AssetCatalogService::parse_catalog_file() is doing.

**System Information** Operating system: Linux-5.15.0-73-generic-x86_64-with-glibc2.35 64 Bits, X11 UI Graphics card: NVIDIA GeForce GTX 1080/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 470.182.03 **Blender Version** Broken: version: 4.0.0 Alpha, branch: main, commit date: `Mon Jun 5 14:21:39 2023 +0200`, hash: `c18ee2e84dcebaf5831640c987e5fd434219e46c` Worked: probably broken since the introduction of the 'All' library **Short description of error** Having two asset libraries that both have a catalog with the same UUID cause an error: ``` BLI_assert failed: blender/source/blender/blenlib/BLI_map.hh:1093, add_new__impl(), at '!this->contains_as(key)' ``` **Exact steps for others to reproduce the error** - Extract the attached ZIP file. It contains a blend file and two asset libraries. - Run Blender in debug mode. - Open the blend file. - Run the script in the text editor (which adds the two asset libraries to your preferences; don't worry, they won't be saved) - Refresh the 'All' asset catalog. - See the failed assertion **Workaround** Applying this patch will work around this issue: ```diff diff --git a/source/blender/asset_system/intern/asset_catalog.cc b/source/blender/asset_system/intern/asset_catalog.cc index d27763c08d7..8512824b6d4 100644 --- a/source/blender/asset_system/intern/asset_catalog.cc +++ b/source/blender/asset_system/intern/asset_catalog.cc @@ -686,7 +686,7 @@ static void copy_catalog_map_into_existing(const OwningAssetCatalogMap &source, { for (const auto &orig_catalog_uptr : source.values()) { auto copy_catalog_uptr = std::make_unique<AssetCatalog>(*orig_catalog_uptr); - dest.add_new(copy_catalog_uptr->catalog_id, std::move(copy_catalog_uptr)); + dest.add(copy_catalog_uptr->catalog_id, std::move(copy_catalog_uptr)); } } ``` A better solution would be to implement some comparison function like `bool AssetCatalog::is_consistent_with(const AC &other);` that tests both the UUID and the catalog path are identical, and issue a warning if they are not, similar to what `AssetCatalogService::parse_catalog_file()` is doing.
Member

can confirm the assert hit

can confirm the assert hit
Pratik Borhade added
Status
Confirmed
and removed
Status
Needs Triage
labels 2023-06-06 06:53:16 +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
2 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#108624
No description provided.