{"record":{"id":"e45cd482e7ba4446","repo":"tauri-apps/tauri","slug":"unable-to-kill-native-webdriver-server","errorCode":null,"errorMessage":"unable to kill native webdriver server","messagePattern":"unable to kill native webdriver server","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"crates/tauri-driver/src/server.rs","lineNumber":186,"sourceCode":"\n#[tokio::main(flavor = \"current_thread\")]\npub async fn run(args: Args, mut _driver: Child) -> Result<(), Error> {\n  #[cfg(unix)]\n  let (signals_handle, signals_task) = {\n    use futures_util::StreamExt;\n    use signal_hook::consts::signal::*;\n\n    let signals = signal_hook_tokio::Signals::new([SIGTERM, SIGINT, SIGQUIT])?;\n    let signals_handle = signals.handle();\n    let signals_task = tokio::spawn(async move {\n      let mut signals = signals.fuse();\n      #[allow(clippy::never_loop)]\n      while let Some(signal) = signals.next().await {\n        match signal {\n          SIGTERM | SIGINT | SIGQUIT => {\n            _driver\n              .kill()\n              .expect(\"unable to kill native webdriver server\");\n            std::process::exit(0);\n          }\n          _ => unreachable!(),\n        }\n      }\n    });\n    (signals_handle, signals_task)\n  };\n\n  let address = std::net::SocketAddr::from(([127, 0, 0, 1], args.port));\n\n  // the client we use to proxy requests to the native webdriver\n  let client = Client::builder(TokioExecutor::new())\n    .http1_preserve_header_case(true)\n    .http1_title_case_headers(true)\n    .retry_canceled_requests(false)\n    .build_http();\n","sourceCodeStart":168,"sourceCodeEnd":204,"githubUrl":"https://github.com/tauri-apps/tauri/blob/460ec35447493200d64290dd7f015d5a91d0fd58/crates/tauri-driver/src/server.rs#L168-L204","documentation":"Panic in tauri-driver's server signal handler: on receiving SIGTERM/SIGINT/SIGQUIT the handler calls `_driver.kill()` on the native webdriver child process and `.expect`s success. If the child has already exited or kill fails (process gone, permission problem), this panics. It happens during shutdown, so the impact is an ugly crash instead of a clean exit.","triggerScenarios":"Pressing Ctrl-C or sending SIGTERM/SIGINT to tauri-driver when the native webdriver child process has already terminated on its own, so `kill()` returns an error.","commonSituations":"Native webdriver crashed mid-session and the user then interrupts tauri-driver; driver binary exited due to its own error; rapid double signal where the first cleanup already reaped the child.","solutions":["Ignore the panic if it occurs only at shutdown — the driver was already dead; fix the underlying reason the webdriver exited (check its stderr).","Change the handler to tolerate kill errors: replace `.expect(...)` with `let _ = _driver.kill();` and exit gracefully.","Investigate why the native webdriver crashed (version mismatch with the browser/WebView, missing deps).","Update tauri-driver/browser driver versions so the child process stays alive through the session."],"exampleFix":"// before\n_driver.kill().expect(\"unable to kill native webdriver server\");\n// after\nlet _ = _driver.kill();\nstd::process::exit(0);","handlingStrategy":"try-catch","validationCode":"// check the native webdriver is still alive before sending shutdown signals\npgrep -f msedgedriver || echo \"webdriver already exited — kill will fail during shutdown\"","typeGuard":null,"tryCatchPattern":"// tolerate kill failure during signal shutdown:\nmatch _driver.kill() {\n  Ok(_) => {}\n  Err(e) => eprintln!(\"webdriver already exited: {e}\"),\n}\nstd::process::exit(0);","preventionTips":["Investigate and fix native webdriver crashes so it stays alive for the session","Send interrupt signals only once and wait for graceful shutdown","Patch handlers to treat kill errors as non-fatal during shutdown","Keep tauri-driver and the browser driver versions compatible"],"tags":["process-management","signals","tauri-driver","shutdown","webdriver"],"backgroundTag":"internal-invariant-violation","analyzedSha":"460ec35447493200d64290dd7f015d5a91d0fd58","analyzedAt":"2026-09-18T23:55:51.277Z","contentChangedAt":"2026-09-18T23:55:51.277Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}