Regression: Node Editor: Crash On Typing or Scrolling In Add Search #101245

Closed
opened 2022-09-21 10:05:24 +02:00 by RoyTheKoi · 36 comments

System Information
MacBook Pro (16-inch, 2019)
Operating system: macOS Monterey 12.3
Processor: 2.3 GHz 8-Core Intel Core i9
Graphics card: AMD Radeon Pro 5500M 8 GB

Blender Version
Broken: 3.4.0, 6f15141f27, master, 2022-09-20
Worked: 3.4.0, ecf3435362, master, 2022-09-18
Broken by {bdb57541475f20ccc4f6e5f8fc075ac424becc19}

Short description of error
Blender crashes immediately after typing in the add node search bar, or scrolling past the last visible item. This occurs across all node editors including Shader Nodes, Geometry Nodes, and Compositing.

Exact steps for others to reproduce the error

  1. Create an EXR image with width > 256 and a height of 1 (specifically any ratio greater than 256:1 horizontally or vertically)
  2. Save the image externally in a folder
  3. In Blender, assign that folder as an asset library under {nav Preferences > File Paths > Asset Libraries}
  4. Restart Blender
  5. Go to any node editor and use {nav Add > Search}
  6. Type anything to crash Blender
**System Information** MacBook Pro (16-inch, 2019) Operating system: macOS Monterey 12.3 Processor: 2.3 GHz 8-Core Intel Core i9 Graphics card: AMD Radeon Pro 5500M 8 GB **Blender Version** Broken: 3.4.0, 6f15141f2731, master, 2022-09-20 Worked: 3.4.0, ecf3435362cf, master, 2022-09-18 Broken by {bdb57541475f20ccc4f6e5f8fc075ac424becc19} **Short description of error** Blender crashes immediately after typing in the add node search bar, or scrolling past the last visible item. This occurs across all node editors including Shader Nodes, Geometry Nodes, and Compositing. **Exact steps for others to reproduce the error** 1. Create an EXR image with width > 256 and a height of 1 (specifically any ratio greater than 256:1 horizontally or vertically) 2. Save the image externally in a folder 3. In Blender, assign that folder as an asset library under {nav Preferences > File Paths > Asset Libraries} 4. Restart Blender 5. Go to any node editor and use {nav Add > Search} 6. Type anything to crash Blender
Author

Added subscriber: @RoyTheKoi

Added subscriber: @RoyTheKoi
Member

Added subscriber: @PratikPB2123

Added subscriber: @PratikPB2123
Member

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

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

Hi, thanks for the report. I'm not able to redo the crash as described in current master.
Do you use any add-ons? Maybe worth to check with factory settings: {nav File > Defaults > Load Factory Settings}

Hi, thanks for the report. I'm not able to redo the crash as described in current master. Do you use any add-ons? Maybe worth to check with factory settings: {nav File > Defaults > Load Factory Settings}
Author

Thanks for that suggestion, it solved the issue. It turned out to be some old versions of community addons that were causing python errors.

Thanks for that suggestion, it solved the issue. It turned out to be some old versions of community addons that were causing python errors.
Member

It turned out to be some old versions of community addons that were causing python errors.

Thanks for the update. Which add-on BTW?

> It turned out to be some old versions of community addons that were causing python errors. Thanks for the update. Which add-on BTW?
Author

Actually after double checking, it seems the issue is related to something else, although I'm still trying to figure out what that is specifically.

I had thought that the addons (Radeon Pro Render and Animation Nodes, installed a while ago) were the problem since they were throwing python errors, and loading factory settings disabled them.
However without loading factory settings I was still getting crashes even after disabling all addons to be safe. So some other setting must be responsible instead.

Actually after double checking, it seems the issue is related to something else, although I'm still trying to figure out what that is specifically. I had thought that the addons (Radeon Pro Render and Animation Nodes, installed a while ago) were the problem since they were throwing python errors, and loading factory settings disabled them. However without loading factory settings I was still getting crashes even after disabling all addons to be safe. So some other setting must be responsible instead.
Member

bdb5754147 might be related but we need exact way to reproduce the crash to later fix it

bdb5754147 might be related but we need exact way to reproduce the crash to later fix it
Author

Asset libraries do seem to be the cause. Deleting the asset library paths under {nav Preferences -> File Paths -> Asset Libraries} stopped the crashes.

I am doing further testing to find the specific conditions that cause the crash.

Asset libraries do seem to be the cause. Deleting the asset library paths under {nav Preferences -> File Paths -> Asset Libraries} stopped the crashes. I am doing further testing to find the specific conditions that cause the crash.
Author

Opening Blender with terminal showed this message upon crashing:

OpenColorIO Error: PackedImageDesc Error: Invalid image dimensions.
Writing: /tmp/blender.crash.txt
Segmentation fault: 11

There was an EXR file with dimensions of 512x1 in one of my asset libraries. Removing it from the folder stopped the crashes.
I found that crashing would occur even if the folder contained nothing but this image alone.
To be thorough I tested other image dimensions and the threshold seems to be 256x1 pixels. Anything wider results in crashes.

To summarize the steps:

  1. Create an EXR image with width > 256 and a height of 1 (specifically any ratio greater than 256:1 horizontally or vertically)
  2. Save the image externally in a folder
  3. In Blender, assign that folder as an asset library under {nav Preferences > File Paths > Asset Libraries}
  4. Restart Blender
  5. Go to any node editor and use {nav Add > Search}
  6. Type anything to crash Blender
Opening Blender with terminal showed this message upon crashing: ``` OpenColorIO Error: PackedImageDesc Error: Invalid image dimensions. Writing: /tmp/blender.crash.txt Segmentation fault: 11 ``` There was an EXR file with dimensions of 512x1 in one of my asset libraries. Removing it from the folder stopped the crashes. I found that crashing would occur even if the folder contained nothing but this image alone. To be thorough I tested other image dimensions and the threshold seems to be 256x1 pixels. Anything wider results in crashes. To summarize the steps: 1. Create an EXR image with width > 256 and a height of 1 (specifically any ratio greater than 256:1 horizontally or vertically) 2. Save the image externally in a folder 3. In Blender, assign that folder as an asset library under {nav Preferences > File Paths > Asset Libraries} 4. Restart Blender 5. Go to any node editor and use {nav Add > Search} 6. Type anything to crash Blender
Member

Thanks for the further investigation. Still I'm unable to redo it.
Could you also upload the crash logs: https://docs.blender.org/manual/en/latest/troubleshooting/crash.html#macos

Thanks for the further investigation. Still I'm unable to redo it. Could you also upload the crash logs: https://docs.blender.org/manual/en/latest/troubleshooting/crash.html#macos
Author

It looks like Blender isn't generating logs for this crash. For what it's worth there is also no "Blender quit unexpectedly" dialog when the app closes like there is in some other cases.

I have reported a few other bugs/crashes before that only seem to affect this particular model of Mac, perhaps this is another one of those.

It looks like Blender isn't generating logs for this crash. For what it's worth there is also no "Blender quit unexpectedly" dialog when the app closes like there is in some other cases. I have reported a few other bugs/crashes before that only seem to affect this particular model of Mac, perhaps this is another one of those.
Member

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

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

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

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

Can you check again in recent 3.4 build?: https://builder.blender.org/download/daily/

Can you check again in recent 3.4 build?: https://builder.blender.org/download/daily/
Member

Hi, any news?

Hi, any news?
Author

Just checked on the most recent 3.4 daily build (October 20). The crash still occurs under the same conditions (placing a 257x1 pixel EXR image in an asset library folder then using the add-search menu).

Just checked on the most recent 3.4 daily build (October 20). The crash still occurs under the same conditions (placing a 257x1 pixel EXR image in an asset library folder then using the add-search menu).
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

I cannot replicate the problem.
This is the image I tested:
untitled.exr

Maybe it's a Mac only issue.
I don't have the Mac available at the moment to test (only next month).

I cannot replicate the problem. This is the image I tested: ![untitled.exr](https://archive.blender.org/developer/F13750154/untitled.exr) Maybe it's a Mac only issue. I don't have the Mac available at the moment to test (only next month).
Member

Added subscriber: @iss

Added subscriber: @iss
Member

@iss, can you reproduce the crash in mac?

@iss, can you reproduce the crash in mac?

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

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

Can confirm, will bisect.

Can confirm, will bisect.
Richard Antalik changed title from Node Editor: Crash On Typing or Scrolling In Add Search to Regression: Node Editor: Crash On Typing or Scrolling In Add Search 2022-12-03 02:47:33 +01:00

Added subscriber: @HooglyBoogly

Added subscriber: @HooglyBoogly
Hans Goudey self-assigned this 2022-12-05 15:58:06 +01:00
Hans Goudey removed their assignment 2022-12-05 19:31:38 +01:00
Member

I can't reproduce this locally. Seems it is a mac-only issue. Without a stack trace at least, there's not much I can do right now.

I can't reproduce this locally. Seems it is a mac-only issue. Without a stack trace at least, there's not much I can do right now.
Member

Added subscriber: @lone_noel

Added subscriber: @lone_noel
Member

Since I'm on mac I investigated this a bit.

The crash happens during the creation of thumbnails of .exr files with aspect ratio of greater than 256:1.
An easy and reliable way to reproduce the bug on mac is by opening the folder containing the problematic .exr in blender's file browser and switching to the thumbnail preview.

The core issue seems to be that because of float to int truncation imb_load_filepath_thumbnail_openexr creates the image buffer for the thumbnail with a height of 0, which causes OpenColorIO to abort with the following error:

OpenColorIO Error: PackedImageDesc Error: Invalid image dimensions.

Simply clamping the thumbnail dimensions to at least 1 like in the diff below fixes the crash for me, but I think someone with experience in this area should take a closer look :)

diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp
index d2bdb5041c5..c17931827f7 100644
--- a/source/blender/imbuf/intern/openexr/openexr_api.cpp
+++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp
@@ -2213,12 +2213,12 @@ struct ImBuf *imb_load_filepath_thumbnail_openexr(const char *filepath,
       colorspace_set_default_role(colorspace, IM_MAX_SPACE, COLOR_ROLE_DEFAULT_FLOAT);
     }
 
     float scale_factor = MIN2(float(max_thumb_size) / float(source_w),
                               float(max_thumb_size) / float(source_h));
-    int dest_w = int(source_w * scale_factor);
-    int dest_h = int(source_h * scale_factor);
+    int dest_w = MAX2(int(source_w * scale_factor), 1);
+    int dest_h = MAX2(int(source_h * scale_factor), 1);
 
     struct ImBuf *ibuf = IMB_allocImBuf(dest_w, dest_h, 32, IB_rectfloat);
 
     /* A single row of source pixels. */
     Imf::Array<Imf::Rgba> pixels(source_w);
Since I'm on mac I investigated this a bit. The crash happens during the creation of thumbnails of .exr files with aspect ratio of greater than 256:1. An easy and reliable way to reproduce the bug on mac is by opening the folder containing the problematic .exr in blender's file browser and switching to the thumbnail preview. The core issue seems to be that because of float to int truncation `imb_load_filepath_thumbnail_openexr` creates the image buffer for the thumbnail with a height of 0, which causes OpenColorIO to abort with the following error: ``` OpenColorIO Error: PackedImageDesc Error: Invalid image dimensions. ``` Simply clamping the thumbnail dimensions to at least 1 like in the diff below fixes the crash for me, but I think someone with experience in this area should take a closer look :) ``` diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp index d2bdb5041c5..c17931827f7 100644 --- a/source/blender/imbuf/intern/openexr/openexr_api.cpp +++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp @@ -2213,12 +2213,12 @@ struct ImBuf *imb_load_filepath_thumbnail_openexr(const char *filepath, colorspace_set_default_role(colorspace, IM_MAX_SPACE, COLOR_ROLE_DEFAULT_FLOAT); } float scale_factor = MIN2(float(max_thumb_size) / float(source_w), float(max_thumb_size) / float(source_h)); - int dest_w = int(source_w * scale_factor); - int dest_h = int(source_h * scale_factor); + int dest_w = MAX2(int(source_w * scale_factor), 1); + int dest_h = MAX2(int(source_h * scale_factor), 1); struct ImBuf *ibuf = IMB_allocImBuf(dest_w, dest_h, 32, IB_rectfloat); /* A single row of source pixels. */ Imf::Array<Imf::Rgba> pixels(source_w); ```
Member

Added subscribers: @Harley, @ideasman42, @brecht

Added subscribers: @Harley, @ideasman42, @brecht
Member

Thanks for investigating @lone_noel!

@brecht @ideasman42 @Harley (from D14663), the above solution looks simple enough to me, shall we use that?

Thanks for investigating @lone_noel! @brecht @ideasman42 @Harley (from [D14663](https://archive.blender.org/developer/D14663)), the above solution looks simple enough to me, shall we use that?
Member

That looks like a great solution. Although... looks like I made the same mistake twice:

diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp
index d2bdb5041c5d..c17931827f74 100644
--- a/source/blender/imbuf/intern/openexr/openexr_api.cpp
+++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp
@@ -2215,8 +2215,8 @@ struct ImBuf *imb_load_filepath_thumbnail_openexr(const char *filepath,
 
     float scale_factor = MIN2(float(max_thumb_size) / float(source_w),
                               float(max_thumb_size) / float(source_h));
-    int dest_w = int(source_w * scale_factor);
-    int dest_h = int(source_h * scale_factor);
+    int dest_w = MAX2(int(source_w * scale_factor), 1);
+    int dest_h = MAX2(int(source_h * scale_factor), 1);
 
     struct ImBuf *ibuf = IMB_allocImBuf(dest_w, dest_h, 32, IB_rectfloat);
 
diff --git a/source/blender/imbuf/intern/webp.c b/source/blender/imbuf/intern/webp.c
index 3031b8c3e330..97a1d1981985 100644
--- a/source/blender/imbuf/intern/webp.c
+++ b/source/blender/imbuf/intern/webp.c
@@ -112,8 +112,8 @@ struct ImBuf *imb_load_filepath_thumbnail_webp(const char *filepath,
   *r_height = (size_t)config.input.height;
 
   const float scale = (float)max_thumb_size / MAX2(config.input.width, config.input.height);
-  const int dest_w = (int)(config.input.width * scale);
-  const int dest_h = (int)(config.input.height * scale);
+  const int dest_w = MAX2((int)(config.input.width * scale), 1);
+  const int dest_h = MAX2((int)(config.input.height * scale), 1);
 
   colorspace_set_default_role(colorspace, IM_MAX_SPACE, COLOR_ROLE_DEFAULT_BYTE);
   struct ImBuf *ibuf = IMB_allocImBuf(dest_w, dest_h, 32, IB_rect);
That looks like a great solution. Although... looks like I made the same mistake twice: ``` diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp index d2bdb5041c5d..c17931827f74 100644 --- a/source/blender/imbuf/intern/openexr/openexr_api.cpp +++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp @@ -2215,8 +2215,8 @@ struct ImBuf *imb_load_filepath_thumbnail_openexr(const char *filepath, float scale_factor = MIN2(float(max_thumb_size) / float(source_w), float(max_thumb_size) / float(source_h)); - int dest_w = int(source_w * scale_factor); - int dest_h = int(source_h * scale_factor); + int dest_w = MAX2(int(source_w * scale_factor), 1); + int dest_h = MAX2(int(source_h * scale_factor), 1); struct ImBuf *ibuf = IMB_allocImBuf(dest_w, dest_h, 32, IB_rectfloat); diff --git a/source/blender/imbuf/intern/webp.c b/source/blender/imbuf/intern/webp.c index 3031b8c3e330..97a1d1981985 100644 --- a/source/blender/imbuf/intern/webp.c +++ b/source/blender/imbuf/intern/webp.c @@ -112,8 +112,8 @@ struct ImBuf *imb_load_filepath_thumbnail_webp(const char *filepath, *r_height = (size_t)config.input.height; const float scale = (float)max_thumb_size / MAX2(config.input.width, config.input.height); - const int dest_w = (int)(config.input.width * scale); - const int dest_h = (int)(config.input.height * scale); + const int dest_w = MAX2((int)(config.input.width * scale), 1); + const int dest_h = MAX2((int)(config.input.height * scale), 1); colorspace_set_default_role(colorspace, IM_MAX_SPACE, COLOR_ROLE_DEFAULT_BYTE); struct ImBuf *ibuf = IMB_allocImBuf(dest_w, dest_h, 32, IB_rect); ```

The patch from @Harley looks good to me for blender-v3.4-release.

The patch from @Harley looks good to me for `blender-v3.4-release`.
Harley Acheson self-assigned this 2022-12-06 16:48:07 +01:00
Member

on it.

on it.

This issue was referenced by 658220e815

This issue was referenced by 658220e815034a5026fe92164e2f1867ce5e78e7

This issue was referenced by 87582d95df

This issue was referenced by 87582d95dfdbc6df4baff881e0bbe62a1fb45c37
Member

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Thomas Dinges added this to the 3.4 milestone 2023-02-07 19:01:34 +01:00
Bastien Montagne added this to the Core project 2023-02-09 15:43:11 +01:00
Bastien Montagne removed this from the Core project 2023-02-09 18:20:14 +01: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
9 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#101245
No description provided.