Maniphest T93649

Blender freezes when saving with active VR session
Closed, Resolved

Assigned To
Julian Eisel (Severin)
Authored By
Peter Kim (muxed-reality)
Dec 4 2021, 12:52 PM
Tags
  • BF Blender
  • Virtual Reality
Subscribers
Jacob Merrill (blueprintrandom)
Julian Eisel (Severin)
Peter Kim (muxed-reality)

Description

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: rBf1cca3055776
Broken: version: 3.1.0 Alpha, branch: master, commit date: 2021-12-04 01:26, hash: rB5ef5a9fc2466
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

Revisions and Commits

rB Blender

Event Timeline

Peter Kim (muxed-reality) created this task.Dec 4 2021, 12:52 PM
Peter Kim (muxed-reality) added a subscriber: Julian Eisel (Severin).Dec 4 2021, 1:05 PM

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().

@Julian Eisel (Severin) 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.

Peter Kim (muxed-reality) changed the task status from Needs Triage to Confirmed.Dec 4 2021, 1:06 PM
Peter Kim (muxed-reality) added a project: Virtual Reality.
Peter Kim (muxed-reality) moved this task from Backlog to Bugs & Known Issues on the Virtual Reality board.
Jacob Merrill (blueprintrandom) added a subscriber: Jacob Merrill (blueprintrandom).Dec 8 2021, 5:05 PM
Peter Kim (muxed-reality) added a comment.Dec 9 2021, 9:30 AM

@Julian Eisel (Severin) 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()?

Julian Eisel (Severin) closed this task as Resolved by committing rBb5c18288f5bd: Fix T93649: Blender freezes when saving with active VR session.Dec 14 2021, 3:24 PM
Julian Eisel (Severin) claimed this task.
Julian Eisel (Severin) added a commit: rBb5c18288f5bd: Fix T93649: Blender freezes when saving with active VR session.
Jacob Merrill (blueprintrandom) added a comment.Dec 14 2021, 11:47 PM

Thank you @Peter Kim (muxed-reality) and @Julian Eisel (Severin) !!

Philipp Oeser (lichtwerk) added a commit: rB58ee4852b6e2: Fix T93649: Blender freezes when saving with active VR session.Jan 11 2022, 9:33 AM