wry: Android BorrowError panic in wry and inability to restart/launch

Describe the bug I’m attempting to run Tauri on an existing prod React project. I have been encountering a panic somewhat reliably after a deep-link is called (user goes to complete oauth flow, deep-link drops them back in the app successfully - this works great). However, on next app launch it seems like the deep-link state is still present and causes a panic. This panic is then irrecoverable. Force-quit the tauri app = panic. Try and force-quit again and panic. App is then dead mostly. Sometimes it will come back, as if a bad event has been dispatched successfully. Delete the app from the device and it can be reliably installed.

I have been able to cause the same set of panics with a similar flow - when there’s competition for launching the WebKitClient(?).

I haven’t made much more progress on this issue but happy to keep looking into it.

Steps To Reproduce

  • Install Tauri
  • Install deep-link plugin (may not entirely be necessary - I’ve caused it other ways but this seems semi reliable)
  • Configure a deep link
  • Trigger a deep-link to arrive back in app
  • Close the app (kill)
  • Re-launch the app.

Expected behavior No panic.

Screenshots Panic: image

References: image

Platform and Versions (please complete the following information): OS: Android on Pixel 4a 5G. I am port forwarding from the Android device to my dev PC. Rustc: 1.82

Additional context

Logcat Output during the panic (nothing useful beyond the reference to unwinding panic):

...snip...
11-17 08:26:34.924 18908 18908 F DEBUG   :       #08 pc 00000000015c3db8  /data/app/~~XWb8Z89T6mNxIkk6s7bm2A==/io.testy.ui-7cAR2kQUjsQd7GVdttgacA==/base.apk (offset 0x5e8000) (core::panicking::panic_cannot_unwind::he22847d5ac2210b8+20)
11-17 08:26:34.924 18908 18908 F DEBUG   :       #09 pc 0000000000a1c4d8  /data/app/~~XWb8Z89T6mNxIkk6s7bm2A==/io.testy.ui-7cAR2kQUjsQd7GVdttgacA==/base.apk (offset 0x5e8000) (Java_io_testy_ui_RustWebViewClient_withAssetLoader+36)
11-17 08:26:34.924 18908 18908 F DEBUG   :       #10 pc 0000000000384370  /apex/com.android.art/lib64/libart.so (art_quick_generic_jni_trampoline+144) (BuildId: 3f7d5a016e08d528f129bdd336d81168)

Full Logcat output: https://gist.github.com/tristan-morris/44dd5f7e451f6f81d260c7a56b14afa4

$ cargo tauri info

[✔] Environment - OS: Ubuntu 23.4.0 x86_64 (X64) ✔ webkit2gtk-4.1: 2.42.4 ✔ rsvg2: 2.54.5 ✔ rustc: 1.82.0 (f6e511eec 2024-10-15) ✔ cargo: 1.82.0 (8f40fc59f 2024-08-21) ✔ rustup: 1.27.1 (54dd3d00f 2024-04-24) ✔ Rust toolchain: stable-x86_64-unknown-linux-gnu (environment override by RUSTUP_TOOLCHAIN) - node: 21.5.0 - yarn: 1.22.21 - npm: 10.2.4

[-] Packages - tauri 🦀: 2.1.1 - tauri-build 🦀: 2.0.3 - wry 🦀: 0.47.0 - tao 🦀: 0.30.8 - tauri-cli 🦀: 2.1.0 - @tauri-apps/api : 2.1.1 - @tauri-apps/cli : 2.1.0

[-] Plugins - tauri-plugin-log 🦀: 2.0.2 - @tauri-apps/plugin-log : not installed! - tauri-plugin-notification 🦀: 2.0.1 - @tauri-apps/plugin-notification : 2.0.0 - tauri-plugin-shell 🦀: 2.0.2 - @tauri-apps/plugin-shell : 2.0.1 - tauri-plugin-geolocation 🦀: 2.0.1 - @tauri-apps/plugin-geolocation : 2.0.0 - tauri-plugin-deep-link 🦀: 2.0.1 - @tauri-apps/plugin-deep-link : 2.0.0 - tauri-plugin-fs 🦀: 2.0.3 - @tauri-apps/plugin-fs : 2.0.2

[-] App - build-type: bundle - CSP: unset - frontendDist: …/dist - devUrl: http://localhost:3000/ - framework: React - bundler: Rollup

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 5
  • Comments: 20 (2 by maintainers)

Most upvoted comments

Does anyone know how to fix this bug? It’s blocking me from building an Android app using Tauri. 😰

that’s also an outdated wry version (0.48) so basically irrelevant until someone sees it on 0.50.x as well

I am running on wry 0.49, I’ll try to bump to latest to have this fix and will tell if it fixed the issue for me or not! If you want more details, I have an FCM service running for push notifications on Android and that’s all. When I did not have it, it did not crash. Thanks for the quick response, will try it out !

Downgrading the wry version to 0.46.1 appears to resolve the bug. Below is the updated Cargo.toml file

[dependencies]
tauri = { version = "=2.0.6", features = [] }
tauri-runtime-wry = "=2.1.2"
tauri-runtime = "=2.1.1"

We are encountering this exact same issue.