DioxusLabs / DioxusLabs/dioxus

subsecond/hotpatch crashes when Router has more than 5 routes

Open
#4,632 0 comments 0 reactions 0 assignees View on GitHub
bug cli subsecond
Dominant language
Rust
Stars
39.1k
Forks
1.9k
Avg merge
4d 10h
Merged PRs (30d)
4

Description

**Problem**
Following code failed to hotpatch, any edit would crash with `thread 'main' has overflowed its stack`
```rust
// dioxus = { version = "0.7.0-rc.0", features = ["router"] }
use dioxus::prelude::*;

#[derive(Debug, Clone, Routable, PartialEq)]
#[rustfmt::skip]
enum Route {
#[layout(MainView)]
#[route("/")]
Page1 {},
#[route("/page2")]
Page2 {},
#[route("/page3")]
Page3 {},
#[route("/page4")]
Page4 {},
#[route("/page5")]
Page5,
}

#[component]
fn Page1() -> Element {
rsx! {
div { "Home" }
}
}
#[component]
fn Page2() -> Element {
rsx! {
div { "Page2" }
}
}
#[component]
fn Page3() -> Element {
rsx! {
div { "Page3" }
}
}
#[component]
fn Page4() -> Element {
rsx! {
div { "Page4" }
}
}
#[component]
fn Page5() -> Element {
rsx! {
div { "Page5" }
}
}

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

#[component]
fn app() -> Element {
println!("Hello, world!");
rsx! {
Router:: { }
}
}

/// Shared navbar component.
#[component]
fn MainView() -> Element {
rsx! {
Outlet:: {}
}
}
```

**Steps To Reproduce**

Steps to reproduce the behavior:

- create a Router with `>=5` routes
- run `dx serve --hotpatch`
- edit `println!("Hello, world!");` to `println!("Hello, world!!");`
- if comment out `#[route("/page5")] Page5,` and retry above steps, the hotpatch would work

**Expected behavior**

Hot patch success

**Screenshots**

```
15:06:26 [dev] Build completed successfully in 4239ms, launching app! 💫
15:06:28 [windows] Hello, world!
15:06:33 [dev] Hot-patching: \src\main.rs took 1100ms
15:06:33 [windows] Hello, world!!
15:06:33 [windows] thread 'main' has overflowed its stack
15:06:33 [dev] Application [windows] exited with error: exit code: 0xc00000fd
15:06:36 [dev] Hot-patching: \src\main.rs took 981ms
```

**Environment:**

- Dioxus version: 0.7.0-rc.0
- Rust version: rustc 1.89.0 (29483883e 2025-08-04)
- OS info: Windows 11, x86_64
- App platform: desktop

**Questionnaire**

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.