#Intermittent bug

1 messages · Page 1 of 1 (latest)

north temple
#

There seems to be a bug which is very hard to reproduce reliably. I want to report it but I'm not convinced I could make a reproducible example. Should I just report it anyway or should I try to describe it here?

copper canopy
#

Sure let’s hear it. It might be reported already.

north temple
#

I have a web app which when it is closed it attempts to send all of it's data. This usually happens in several PUT requests. Because this is in a beforeunload event the connections usually get closed before the server can respond because the user is navigated away from the page.

If I don't write a service handler for the URL the requests go to then sometimes (maybe 10% of the time) the server hangs and some of the subsequent requests made to the server (not to this URL) get stuck and end up timing out. Also, if I try to close the process in the terminal with ctrl+c then the process closes but my application window does not close.

If I write a handler for that URL (even if all I do is return a HttpResponse::NotFound().finish()) then this does not happen.

This problem actually ends up breaking my entire application at random intervals.

My guess is that the default NotFound response isn't cleaning up correctly after a loss of connection.

A little info about my setup.

OS: macOS M1 chipset
The server is running inside a tauri app in a separate thread like so:

#[actix_web::main]
pub async fn init(app: AppHandle) -> std::io::Result<()> {
    let tauri_app = web::Data::new(TauriAppState {
        app: Mutex::new(app),
    });

    HttpServer::new(move || {
        App::new()
            .app_data(tauri_app.clone())
            .wrap(middleware::Logger::default())
            .service(handlers::module::serve)
    })
    .bind(("127.0.0.1", 4875))?
    .run()
    .await
}
fn main() {
  tauri::Builder::default()
        .setup(|app| {
              let handle = app.handle();
              let boxed_handle = Box::new(handle);
              
              thread::spawn(move || {
                  server::init(*boxed_handle).unwrap();
              });
              Ok(())
        ])
        .run(tauri::generate_context!())
        .expect("error while running tauri application");
}

north temple
#

@copper canopy Is this a known issue?

copper canopy
#

It sounds similar to something else but the fact that it’s on beforepageunload is new. I’d like to make some time to try out your example code.