[bug] custom IPC procotol on V2 beta panics if used with async commands #9794
Labels
platform: Linux
priority: 1 high
status: needs triage
This issue needs to triage, applied to new issues
type: bug
Describe the bug
Attempting to set up a V2 beta Tauri app and use raw command request/responses fails with a panic if the command is async.
To test:
create-tauri-app
to scaffold a basic Tauri + React project.linux-ipc-protocol
feature insrc-tauri/Cargo.toml
for thetauri
crate.greet
function and calling code to useUint8Array
on the client side, andtauri::ipc::{Request, Response}
on the Rust side and UTF-8 byte arrays for the strings passed back and forth.greet
markedasync
and without.Thanks! ❤️
Reproduction
I've created a minimal case to reproduce this at https://github.com/petejohanson/test-async-custom-protocol/
If you change the
greet
function declaration at https://github.com/petejohanson/test-async-custom-protocol/blob/main/src-tauri/src/main.rs#L10 to remove theasync
then it works as expected.With that test case as is, at least on latest Fedora, the following produces a panic:
RUST_BACKTRACE=1 npm run tauri dev
asdf
into the text entryExpected behavior
async command completes, and greeting text is returned to the web code, just like happens with non-async command.
Full
tauri info
outputStack trace
Additional context
The stacktrace points to this key line in
URISchemeResponse::new
which first assertsassert_initialized_main_thread!();
which I assume is failing when async because the executor is running the command on some thread other than the main thread.The text was updated successfully, but these errors were encountered: