Open dceddia opened 5 months ago
Minimal reproduction: https://github.com/Ovenoboyo/tauri-tracing-deadlock
^ The code spawns a thread which loops and keeps emitting events to the webview The webview on receiving the event calls an invoke command
With the tracing feature active, the main thread is stuck on acquiring the lock since the thread with tracing is still waiting for a message from the webview.
Describe the bug
[ moving this here from Discord ]
I'm getting a deadlock when I try to resize the window (or re-focus it, or any other action that sends a window event from the main thread to itself).
See the video for some more details, but this is the gist:
It seems like the deadlock is caused when one of my (not main) threads runs a
window.emit('whatever', ...)
, which acquires a lock on the webview and holds it until the script has been run (I think - not 100% sure on what it waits for). Then when I resize the window, that tries to acquire a lock on the webview too, which is already locked by the emitted event. Then it just hangs forever because it can't get the lock until the main thread runs the emitted JS thing, which will never happen because it's paused waiting for the lock π That's my theory anyway.I noticed it seemed to start happening when I added the tauri-devtools plugin. With Fabian's suggestion in Discord, I was able to create a minimal reproduction with just the tauri
tracing
feature enabled. I can't get it to happen whentracing
is not enabled.Fabian thought this might be related: https://github.com/tauri-apps/tauri/pull/9429
https://github.com/tauri-apps/tauri/assets/505704/4f4f5b9d-ad1d-4dce-a030-93c341e90798
Reproduction
https://github.com/dceddia/tauri-tracing-freeze
Expected behavior
Ideally no deadlock π
Full
tauri info
outputStack trace
Additional context
No response