plugins-workspace icon indicating copy to clipboard operation
plugins-workspace copied to clipboard

[log] process hang and never open the window if add dep `tokio` with `signal` feature

Open meowtec opened this issue 2 years ago • 4 comments

platform

Linux / macOS, but not Windows

reproduction

https://github.com/meowtec/bug-reproductions/tree/tauri-log the branch is tauri-log

  1. usetauri-plugin-log
  2. add dependence tokio with the signal feature
  3. add some log in setup() hook
  4. npm run tauri dev

main.rs

fn main() {
    tauri::Builder::default()
        .plugin(
            tauri_plugin_log::Builder::default()
                .targets([LogTarget::LogDir, LogTarget::Stdout, LogTarget::Webview])
                .build(),
        )
        .setup(move |_app| {
            // NOTICE: use log here!!!
            log::info!("setup app");
            Ok(())
        })
        .run(tauri::generate_context!())
        .expect("error while running tauri application");
}

Cargo.toml

[dependencies]
tauri = { version = "1.2", features = ["shell-open"] }
log = "0.4"
tauri-plugin-log = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev" }

# NOTICE: add tokio!!!!
tokio = { version = "1", features = ["signal"] }

The window will never show.

The output:

> [email protected] tauri
> tauri dev

        Info Watching /bugs-report/src-tauri for changes...
    Finished dev [unoptimized + debuginfo] target(s) in 0.13s
Could not determine the accessibility bus address
[2023-04-15][14:21:50][tauri_app][INFO] setup app
[2023-04-15][14:21:50][mio::poll][TRACE] registering event source with poller: token=Token(2147483649), interests=READABLE

meowtec avatar Apr 15 '23 14:04 meowtec

/upstream tauri-apps/tauri

This seems to concern tauri's event system (or at least emit) in general, not just the plugin. Let's see if our github bot works in this repo too :D

FabianLars avatar Apr 17 '23 07:04 FabianLars

I met the same problem and removing LogTarget::Webview worked for me.

yuezk avatar May 23 '23 07:05 yuezk

I met the same problem and removing LogTarget::Webview worked for me.

Yes, this workaround worked for me too.

meowtec avatar May 29 '23 10:05 meowtec

Thats a pretty weird bug. Just faced it myself. Any reason why this happens? I guess the docs must be updated for this case so that others can fix it themselves

Lurrobert avatar May 04 '24 11:05 Lurrobert