Skip to content

Webview connection lost as system goes to sleep #4401

Open
@devnought

Description

@devnought

Problem
If a dioxus desktop application is running on Windows and the system goes to sleep, the UI cannot be updated after the system wakes up. The connection to the webview is lost as the system starts shutting down, and never recovers.

If the application was started using dx serve, it gives the following error:

Error sending edits to webview: IO error: An established connection was aborted by the software in your host machine.

Steps To Reproduce

  • create a signal to store an integer value
  • create a future to periodically increment the integer
  • make the UI display the value
  • run the application
  • put the system to sleep
  • wake the system back up
  • observe the UI has stopped updating

I have created the following minimal example that demonstrates the issue: https://github.com/devnought/dioxus7-update-sleep-bug

// main.rs

use dioxus::prelude::*;

const MAIN_CSS: Asset = asset!("/assets/main.css");

fn main() {
    dioxus::launch(App);
}

#[component]
fn App() -> Element {
    let mut counter = use_signal(|| 0);
    use_future(move || async move {
        loop {
            tokio::time::sleep(std::time::Duration::from_secs(1)).await;
            counter += 1;
            println!("{counter}");
        }
    });

    rsx! {
        document::Link { rel: "stylesheet", href: MAIN_CSS }
        div { "{counter}" }
    }
}

Expected behavior
The UI should continue to receive updates after the system wakes back up from sleep.

Screenshots

  • the system was being put to sleep around update 13 (17:32:24)
  • went and grabbed a snack, came back and powered back up a few minutes later (17:36:42)
Image

Environment:

  • Dioxus version: 0.7.0-alpha.2
  • Rust version: rustc 1.88.0 (6b00bc388 2025-06-23)
  • OS info: Microsoft Windows Version 24H2 (OS Build 26100.4351)
  • App platform: Desktop

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions