tauri-apps / tauri

Build smaller, faster, and more secure desktop applications with a web frontend.
https://tauri.app
Apache License 2.0
79.46k stars 2.36k forks source link

[bug] [macos] App is crashing when webview is reloads while async command running #9933

Open pashokitsme opened 1 month ago

pashokitsme commented 1 month ago

Describe the bug

If i call async command (#[tauri::command(async)]) and reload page (window.location.reload()) while command still running, app crashes right after command is done. Sometimes, when tokio decides to run command in other thread, not whole app crashes but this thread

Also tested on windows and linux where i didn't faced with that issue

Reproduction

Minimal reproducible repo (requires python3 as http server): https://github.com/pashokitsme/async-command-panic

Steps:

  1. Run async command
  2. window.location.reload()

Expected behavior

No response

Full tauri info output

WARNING: no lock files found, defaulting to npm

[✔] Environment
    - OS: Mac OS 13.5.2 X64
    ✔ Xcode Command Line Tools: installed
    ✔ rustc: 1.78.0 (9b00956e5 2024-04-29)
    ✔ cargo: 1.78.0 (54d8815d0 2024-03-26)
    ✔ rustup: 1.27.1 (2024-04-24)
    ✔ Rust toolchain: stable-aarch64-apple-darwin (environment override by RUSTUP_TOOLCHAIN)
    - node: 22.1.0
    - pnpm: 9.1.1
    - yarn: 1.22.22
    - npm: 10.7.0
    - bun: 1.1.8

[-] Packages
    - tauri [RUST]: 2.0.0-beta.22
    - tauri-build [RUST]: 2.0.0-beta.17
    - wry [RUST]: 0.40.0
    - tao [RUST]: 0.28.0
    - tauri-cli [RUST]: 2.0.0-beta.20
    - @tauri-apps/api : not installed!
    - @tauri-apps/cli [NPM]: 2.0.0-beta.20

[-] App
    - build-type: bundle
    - CSP: unset
    - frontendDist: ./frontend
    - devUrl: http://localhost:5173/

Stack trace

No response

Additional context

https://github.com/tauri-apps/tauri/assets/60939712/01feee0c-c403-4cce-8d4b-541d5b2ed443

image
FabianLars commented 4 weeks ago

Tracked upstream in https://github.com/tauri-apps/wry/issues/1142 / https://github.com/tauri-apps/wry/issues/1189 (PR exists already)

tance77 commented 1 week ago

Hey @FabianLar,

Just wondering if this fix is planned for production soon?

FabianLars commented 1 week ago

I assume we release new versions when Lucas and Amr are back from vacation next week.

reyamir commented 5 days ago

Hi, any updates on this issue? this will fix a lot of problems in my app

tance77 commented 4 days ago

I'm going insane it crashes so often when I reload :(