Open dyzdyz010 opened 1 year ago
Can you share an actual reproduction example (a repo we can look at)? Since there are no warnings/errors i'd suspect a logic error/oversight first.
Could you please give more context?
Identified this problem after discussing it with @FabianLars on Discord. The crash isn't React-specific, it affects all frontend frameworks including vanilla.
Here's a minimal repro of the issue in a project bootstrapped by the CTA vanilla template: https://github.com/clearlysid/tauri-multiwindow-crash-test
yarn tauri dev
src/second.html
.Just realized. The order of windows spawned and closed doesn't matter — if you have 2 (or more) windows, close any one of them and proceed to make changes to your frontend, your app WILL crash 😭
This works fine on my Windows machine, I see that the OP was on macOS so I will let someone else test on macOS.
@clearlysid were you also on macOS?
Yes, I was on macOS. I can re-check for Windows today and confirm.
Sorry I didn't get to update here. Me and a colleague both tried and were not able to reproduce the crash on Windows. Definitely seems like a macOS-only bug 🥲
Log when running with --verbose terminates with
Debug [hyper::proto::h1::io] flushed 1426 bytes
Debug [hyper::proto::h1::conn] read eof
Debug [hyper::proto::h1::conn] read eof
Interestingly adding the following snippet in the Tauri main function fixes the issue, as per this PR
.on_window_event(|event| match event.event() {
tauri::WindowEvent::CloseRequested { api, .. } => {
event.window().hide().unwrap();
api.prevent_close();
}
_ => {}
I think I've been seeing a similar crash, but I only have a single window in my app. I narrowed it down to where it will crash if:
main.ts
or something)Here's a minimal repro: https://github.com/dceddia/tauri-crash-ipc
I haven't been able to get it to print a stack trace with RUST_BACKTRACE=1
but I did notice I can attach a debugger before it crashes and find the stack that way.
I'm having the same problem with a single window. Every time I recompile the front-end (i'm using Angular) and I invoke a particular tauri command it makes the webview freeze, like the invocation is not returning and stays hanging. The backend is not throwing any errors and it doesn't even panic. It seems that making the tauri command async doesn't make the webview freeze at the first call after recompilation, but it will eventually freeze after a couple of calls.
@Palm5 this is unrelated to this issue. Sync commands run on the main thread so are expected to freeze your app if they are running for a long time. The problem with the async command is a bit concerning though so please open a new issue with the code of that command.
Describe the bug
I'm creating a multi-window app using Tauri. When I'm in dev I run
npm run tauri dev
to start the dev environment.I use rust to create a window in runtime and close the first window. When I'm working on this newly created window, I hit
save
on frontend's entrymain.tsx
, the app crashes, and the command exits immediately without any warnings or errors, nothing.Reproduction
npm run tauri dev
main.tsx
fileExpected behavior
Live-load changes to my source code as expected
Platform and versions
Additional context
No response