bombomby / optick

C++ Profiler For Games
https://optick.dev
MIT License
2.95k stars 296 forks source link

Optick UE5 plugin deadlocks when stopping capture #170

Open arturmazurek opened 2 years ago

arturmazurek commented 2 years ago

I have a deadlock when stopping Optick capture on a cook from UE5. It happens around 100% times during gameplay, in main menu is around 50%. OptickPlugin version is 1.4.0

Looking at callstacks two threads deadlock - the main game thread and render thread.

Game thread looks like this: image Core::Update() locks the coreLock and above it FOptickPlugin::StopCapture tries to lock UpdateCriticalSection

Render thread looks like this: image And here FOptickPlugin::OnEndFrameRT locks UpdateCriticalSection and Core::EndUpdateFrame tries to lock already locked coreLock.

That results in deadlock. Unfortunately seems to me that fixing it requires a bit more understanding of the plugin than I have, so am reporting this as an issue instead of going for a pull request already.