crash when running python in background mode and calling region_3d.update() #102738

Closed
opened 2022-11-24 08:15:20 +01:00 by Firas · 6 comments

System Information
Operating system: Windows-10-10.0.22000-SP0 64 Bits
Graphics card: NVIDIA GeForce RTX 3060 Laptop GPU/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 526.86

Blender Version
Broken: version: 3.5.0 Alpha, branch: master, commit date: 2022-11-23 18:35, hash: f4e1f62c62

Short description of error
I need to run a python script in background mode, without GUI. The purpose is to unwrap uv from top view of some loaded object & texture. To do that, I use the project_from_view operation after setting the view to TOP. As I saw in the forums, I need to run region_3d.update() between those calls so that the top view operation takes effect, and calling this function crashes blender with EXCEPTION_ACCESS_VIOLATION .
Note that running this code while Blender is open, worksperfectly, however, when I run it in background mode it crashes

Exact steps for others to reproduce the error
[Please describe the exact steps needed to reproduce the issue]

  1. use the attached small script. called crash_repro.py
  2. use any simple scene, attached .blend file with cube for example, called untitled.blend
  3. open command line and run:
blender.exe untitled.blend --background --python crash_repro.py

blender should crash with a crash report, attached a sample, showing that the update() is to blame.

untitled.blend

untitled.crash.txt

crash_repro.py.txt

crash_repro.py

**System Information** Operating system: Windows-10-10.0.22000-SP0 64 Bits Graphics card: NVIDIA GeForce RTX 3060 Laptop GPU/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 526.86 **Blender Version** Broken: version: 3.5.0 Alpha, branch: master, commit date: 2022-11-23 18:35, hash: `f4e1f62c62` **Short description of error** I need to run a python script in background mode, without GUI. The purpose is to unwrap uv from top view of some loaded object & texture. To do that, I use the project_from_view operation after setting the view to TOP. As I saw in the forums, I need to run region_3d.update() between those calls so that the top view operation takes effect, and calling this function crashes blender with EXCEPTION_ACCESS_VIOLATION . Note that running this code while Blender is open, **works**perfectly, however, when I run it in background mode it crashes **Exact steps for others to reproduce the error** [Please describe the exact steps needed to reproduce the issue] 1. use the attached small script. called crash_repro.py 2. use any simple scene, attached .blend file with cube for example, called untitled.blend 3. open command line and run: ``` blender.exe untitled.blend --background --python crash_repro.py ``` blender should crash with a crash report, attached a sample, showing that the update() is to blame. [untitled.blend](https://archive.blender.org/developer/F13964916/untitled.blend) [untitled.crash.txt](https://archive.blender.org/developer/F13964915/untitled.crash.txt) [crash_repro.py.txt](https://archive.blender.org/developer/F13964914/crash_repro.py.txt) [crash_repro.py](https://archive.blender.org/developer/F13964913/crash_repro.py)
Author

Added subscriber: @Firasshama

Added subscriber: @Firasshama

Added subscriber: @mano-wii

Added subscriber: @mano-wii

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

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

The crash is because Space.region_3d.update() internally calls the GPU API without having GPU context.
(See view3d_winmatrix_set, GPU_matrix_ortho_set, or GPU_matrix_frustum_set).

The crash is because `Space.region_3d.update()` internally calls the GPU API without having GPU context. (See `view3d_winmatrix_set`, `GPU_matrix_ortho_set`, or `GPU_matrix_frustum_set`).
Contributor

Added subscriber: @Raimund58

Added subscriber: @Raimund58
Philipp Oeser removed the
Interest
EEVEE & Viewport
label 2023-02-09 15:12:01 +01:00
Member

I don't consider this a bug. Calling an operator from background can be expected to lead to these issues. As operators might require the GPU and the GPU is only available when running with UI. The region 3d is an editor structure and is expected to be run with UI.

I don't consider this a bug. Calling an operator from background can be expected to lead to these issues. As operators might require the GPU and the GPU is only available when running with UI. The region 3d is an editor structure and is expected to be run with UI.
Blender Bot added
Status
Archived
and removed
Status
Confirmed
labels 2023-03-20 10:53:55 +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
4 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#102738
No description provided.