Python: Crash when bpy.ops.wm.previews_ensure() called after queuing asset_generate_preview() job #105325
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
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
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
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
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
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
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
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
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#105325
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
System Information
Operating system: Windows 11
Graphics card: NVIDIA RTX 3060 Ti
Blender Version
Broken: 3.6.0
Short description of error
A crash can be triggered by running the following script in a headless session:
This however does not crash:
The console output is this:
Exact steps for others to reproduce the error
Can confirm.
Interestingly, using
object.preview_ensure()
in the loop instead ofobject.asset_generate_preview()
does not crash.Somehow, the GPUBackend is NULL in
GPU_render_begin
(but this is the case for both of the above, sopreview_ensure()
seems to do something to prevent the crash later)Not sure if these really help, but here are some traces:
headless previews_ensure after preview_ensure (GPUBackend is NOT there)
headless previews_ensure after asset_generate_preview (GPUBackend is NOT there)
headless regular image render (GPUBackend is there)
Python: Crash when bpy.ops.wm.previews_ensure() called after queuing preview render jobto Python: Crash when bpy.ops.wm.previews_ensure() called after queuing asset_generate_preview()Python: Crash when bpy.ops.wm.previews_ensure() called after queuing asset_generate_preview()to Python: Crash when bpy.ops.wm.previews_ensure() called after queuing asset_generate_preview() jobAh, OK, this is indeed caused by the fact that
ED_asset_generate_preview
callsUI_icon_render_id
as a job, whereaspreviews_id_ensure
doesnt...The following would fix this (would need to check if this is a common way do in background mode...)
@dr.sybren , @mont29 : opinions?
OTOH, asking this on the sideline: does it really make sense to call
bpy.ops.wm.previews_ensure()
after we have looped and generated previews already? This seems to do the same thing again?In any case, preventing a crash is always a good thing imo.
bpy.ops.wm.previews_ensure()
does not generate previews for objects, which is arguably a bug or oversight since there's no other way to ensure that previews are generated for object assets.Sorry, yeah, that is only for materials, textures, images, worlds and lights.
Will just submit a PR for the suggested fix (so will put on my desk)