_emscripten_run_callback_on_thread causing deadlocks

26 views
Skip to first unread message

Stephan Bergmann

unread,
Aug 22, 2024, 9:44:51 AM8/22/24
to emscripte...@googlegroups.com, Sam Clegg
After upgrading emsdk to something that includes
<https://github.com/emscripten-core/emscripten/commit/c41f6590b1f9fcda12b2adb2d32cd352f163e717>
"Remove use of legacy proxy API from library_html5.js. NFC (#20370)"
(which switched code from calling `queueEventHandlerOnThread_iiii` ->
`_emscripten_dispatch_to_thread_` to calling
`_emscripten_run_callback_on_thread` -> `emscripten_proxy_sync`), I now
started to get deadlocks, in a somewhat complex scenario running a
Qt5-based LibreOffice with -sPROXY_TO_PTHREAD.

I can get rid of those deadlocks if I change
`_emscripten_run_callback_on_thread` (in `system/lib/html5/callback.c`)
from calling `emscripten_proxy_sync` to `emscripten_proxy_async`, and I
wonder if the use of the `sync` variant was intentional in the above commit?

Sam Clegg

unread,
Aug 22, 2024, 12:03:14 PM8/22/24
to Stephan Bergmann, emscripte...@googlegroups.com
That looks like a regression.  Could you open a bug for this?

Also, can you confirm that https://github.com/emscripten-core/emscripten/commit/c41f6590b1f9fcda12b2adb2d32cd352f163e717 is the culprit?  i.e. reverting this fixes the issue for you?

cheers,
sam

Stephan Bergmann

unread,
Aug 23, 2024, 3:35:52 AM8/23/24
to emscripte...@googlegroups.com, Sam Clegg
On 8/22/24 18:02, Sam Clegg wrote:
> That looks like a regression.  Could you open a bug for this?

see <https://github.com/emscripten-core/emscripten/issues/22442>
"Deadlock with -sPROXY_TO_PTHREAD and
_emscripten_set_resize_callback_on_thread"

> Also, can you confirm that
> https://github.com/emscripten-core/emscripten/commit/c41f6590b1f9fcda12b2adb2d32cd352f163e717 <https://github.com/emscripten-core/emscripten/commit/c41f6590b1f9fcda12b2adb2d32cd352f163e717> is the culprit?  i.e. reverting this fixes the issue for you?

yes, confirmed
Reply all
Reply to author
Forward
0 new messages