Blender freezes when saving with active VR session #93649

Closed
opened 2021-12-04 12:52:25 +01:00 by Peter Kim · 10 comments
Member

System Information
Operating system: Windows-10-10.0.19043-SP0 64 Bits
Graphics card: NVIDIA GeForce GTX 1060/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 497.09

Blender Version
Broken: version: 3.0.0, branch: master, commit date: 2021-12-02 18:35, hash: f1cca30557
Broken: version: 3.1.0 Alpha, branch: master, commit date: 2021-12-04 01:26, hash: 5ef5a9fc24
Worked: 2.93.6

Short description of error
Blender freezes completely when saving while a VR session is active. This does not recover and the user must force quit Blender.

Exact steps for others to reproduce the error

  1. Open Blender and start a new VR session (enable the VR Scene Inspection add-on)
  2. Save the current file
**System Information** Operating system: Windows-10-10.0.19043-SP0 64 Bits Graphics card: NVIDIA GeForce GTX 1060/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 497.09 **Blender Version** Broken: version: 3.0.0, branch: master, commit date: 2021-12-02 18:35, hash: `f1cca30557` Broken: version: 3.1.0 Alpha, branch: master, commit date: 2021-12-04 01:26, hash: `5ef5a9fc24` Worked: 2.93.6 **Short description of error** Blender freezes completely when saving while a VR session is active. This does not recover and the user must force quit Blender. **Exact steps for others to reproduce the error** 1. Open Blender and start a new VR session (enable the VR Scene Inspection add-on) 2. Save the current file
Author
Member

Added subscriber: @muxed-reality

Added subscriber: @muxed-reality
Author
Member

Added subscriber: @JulianEisel

Added subscriber: @JulianEisel
Author
Member

This seems to be caused by calling BKE_scene_graph_evaluated_ensure() when drawing to the XR surface (wm_xr_session_surface_draw()).
The main thread hangs at pthread_cond_wait(&ticket->cond, &ticket->mutex); in BLI_ticket_mutex_lock().

vr-save-freeze-callstack.png

@JulianEisel Would you happen to know how to fix this? I think this is a quite serious issue and should be included in the next 3.0 corrective release if possible.

This seems to be caused by calling `BKE_scene_graph_evaluated_ensure()` when drawing to the XR surface (`wm_xr_session_surface_draw()`). The main thread hangs at `pthread_cond_wait(&ticket->cond, &ticket->mutex);` in `BLI_ticket_mutex_lock()`. ![vr-save-freeze-callstack.png](https://archive.blender.org/developer/F12688999/vr-save-freeze-callstack.png) @JulianEisel Would you happen to know how to fix this? I think this is a quite serious issue and should be included in the next 3.0 corrective release if possible.
Author
Member

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

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

Added subscriber: @JacobMerrill-1

Added subscriber: @JacobMerrill-1
Author
Member

@JulianEisel The hang occurs because DST.gl_context_mutex is already locked in DRW_xr_drawing_begin(), which is set as the "activate" callback for the XR surface.
Then if the depsgraph is not evaluated at the time of surface drawing (which only seems to occur when saving files), BKE_scene_graph_evaluated_ensure() will call DRW_notify_view_update() which will also try to lock DST.gl_context_mutex.

Not sure what the best solution is, maybe we can skip ensuring an evaluated depsgraph before drawing? Or do this instead in wm_xr_events_handle()?

@JulianEisel The hang occurs because `DST.gl_context_mutex` is already locked in `DRW_xr_drawing_begin()`, which is set as the "activate" callback for the XR surface. Then if the depsgraph is not evaluated at the time of surface drawing (which only seems to occur when saving files), `BKE_scene_graph_evaluated_ensure()` will call `DRW_notify_view_update()` which will also try to lock `DST.gl_context_mutex`. Not sure what the best solution is, maybe we can skip ensuring an evaluated depsgraph before drawing? Or do this instead in `wm_xr_events_handle()`?

This issue was referenced by 58ee4852b6

This issue was referenced by 58ee4852b6e2d745965f34ef347d5bd6d6e03fbb

This issue was referenced by b5c18288f5

This issue was referenced by b5c18288f5bdcc95ac012a1ee32d1e2859a97779
Member

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Julian Eisel self-assigned this 2021-12-14 15:24:14 +01:00

Thank you @muxed-reality and @JulianEisel !!

Thank you @muxed-reality and @JulianEisel !!
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Code Documentation
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
FBX
Interest
Freestyle
Interest
Geometry Nodes
Interest
glTF
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 & 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
Asset System
Module
Core
Module
Development Management
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline & 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
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#93649
No description provided.