overte-org / overte

Overte open source virtual worlds platform.
https://overte.org/
Other
127 stars 47 forks source link

Fix Locker issue in RecordingScriptingInterface #1006

Closed HifiExperiments closed 2 weeks ago

HifiExperiments commented 2 weeks ago

Fixes #1005, my bad for not noticing this

ksuprynowicz commented 2 weeks ago

Assignment client is deadlocking on this PR. I'm working on a fix right now.

ksuprynowicz commented 2 weeks ago

Interface is deadlocking too. It should be pretty easy to fix though.

ksuprynowicz commented 2 weeks ago

Oops... I had wrong project open in clion. I will post more test results in a moment.

ksuprynowicz commented 2 weeks ago

I'm getting a very weird assert on script thread:

__pthread_kill_implementation 0x00007ffff06a9e2c
AssetScriptingInterface::jsCallback AssetScriptingInterface.cpp:247
AssetScriptingInterface::jsCallback AssetScriptingInterface.cpp:263
operator() AssetScriptingInterface.cpp:104
<lambda#1>::operator()() const MiniPromises.h:204
MiniPromise::executeOnPromiseThread(std::function<…>, std::shared_ptr<…>) MiniPromises.h:66
Application::notify Application.cpp:4292
ScriptManager::run ScriptManager.cpp:1018
operator() ScriptManager.cpp:419
ksuprynowicz commented 2 weeks ago

I found cause of deadlocks in assignment client and I'm working on a fix.

ksuprynowicz commented 2 weeks ago

I have a fix :) https://github.com/HifiExperiments/overte/pull/1/files

ksuprynowicz commented 2 weeks ago

The reason why the deadlock happened is that some recording API functions can have JS callback. If another recording API function gets called in callbacks, and it blocking-invokes itself on main thread, then deadlock will happen.