Eevee: Race condition in ShaderCreateInfo::finalize() #128164
Labels
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
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 & 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
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#128164
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: macOS-14.6.1-arm64-arm-64bit 64 Bits
Graphics card: Apple M2 Ultra Apple 4.1 Metal - 88.1
Blender Version
Broken: Recent 4.3 main (
8dcd51ddc3
)Worked: 4.2
Short description of error
It appears that
ShaderCreateInfo::finalize
can be called from multiple threads for the sameShaderCreateInfo
, resulting in the wrong shader: the second thread will return early since the system believes the finalization is done.This seems to be the root cause of Eevee benchmarks failing on the buildbot: https://builder.blender.org/admin/#/builders/243/builds/223
The error there is coming from the shader compilation error:
# error Missing draw_view additional create info on shader create info
. This appears to be due to incomplete shader info used to compile some shaders.Exact steps for others to reproduce the error
tests/benchmarks/eevee/reports/T98989.blend
ShaderCreateInfo::finalize name:eevee_surf_deferred called while other thread is finalizing it
P.S. This is more of a write-up and coordination with Clément (and the PoC code to help triggering the issue) after a pair debugging session.
Leaving @pragma37 to take a look
I assumed this would have been caused by the recent
draw_manager_shader
refactors, but doesn't seem to be the case.The issue here seems that we are compiling, at the same time, deferred and non-deferred shaders (so, different threads) with the same
additonal_info
dependencies.(No idea why this didn't surface earlier)
So, we either ensure that all
additional_info
dependencies are finalized from the main thread (maybe we can finalize directly at theadditional_info
call ?), or add mutexes to everyShaderCreateInfo
(and ensure there are no cyclic dependencies).Using mutexes seems to do the trick, although I'm running into weird issues because theShaderCreateInfo
constructor doesn't seem to be called in all cases.Nope, it was lack of copy constructor.