From 41bbbba8e3484707f38cf4d6b99fd68b0f884973 Mon Sep 17 00:00:00 2001 From: EnRaiha <15997552+EnRaiha@users.noreply.github.com> Date: Thu, 17 Sep 2026 11:35:45 +0800 Subject: [PATCH 1/3] chore(test): raise cargo-run thread stacks to 8 MiB Rust spawns threads with a 2 MiB stack; the Linux main thread gets 8 MiB. The bootstrap runtime raises this for the server, but test runtimes are built by the tokio test macro and keep the default, so debug-profile runs of the native and wire suites abort with "thread ... has overflowed its stack" (2 MiB: 6/7 abort; 4 MiB and above: clean). Set RUST_MIN_STACK for every process cargo runs, so a local run needs no exported environment variable. --- .cargo/config.toml | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 .cargo/config.toml diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 000000000..dd4fbbbd8 --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,10 @@ +# Rust spawns threads with a 2 MiB stack by default; the Linux main thread gets +# 8 MiB. Debug-profile test binaries nest deep enough that the 2 MiB default +# aborts with "thread ... has overflowed its stack" — the bootstrap runtime +# raises this for the server, but test runtimes are built by `#[tokio::test]` +# and keep the default. Give every process cargo runs the main-thread size, so +# `cargo test`, `cargo nextest run` and `cargo run` behave the same without an +# exported RUST_MIN_STACK. CI already passes at the default under the `ci` +# profile; this is for the debug profile every contributor runs. +[env] +RUST_MIN_STACK = "8388608" From 94a42788667e30cfe98603e52ca33dc582eba428 Mon Sep 17 00:00:00 2001 From: EnRaiha <15997552+EnRaiha@users.noreply.github.com> Date: Thu, 17 Sep 2026 22:10:37 +0800 Subject: [PATCH 2/3] chore(test): drop the cargo stack override A tracked .cargo/config.toml is not this repository's convention: .gitignore ignores .cargo/ because that file is each contributor's local override ([build] jobs, [patch]). Tracking it turns every existing local copy into a merge conflict on the next pull. The value moves to the documented command line instead. --- .cargo/config.toml | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100644 .cargo/config.toml diff --git a/.cargo/config.toml b/.cargo/config.toml deleted file mode 100644 index dd4fbbbd8..000000000 --- a/.cargo/config.toml +++ /dev/null @@ -1,10 +0,0 @@ -# Rust spawns threads with a 2 MiB stack by default; the Linux main thread gets -# 8 MiB. Debug-profile test binaries nest deep enough that the 2 MiB default -# aborts with "thread ... has overflowed its stack" — the bootstrap runtime -# raises this for the server, but test runtimes are built by `#[tokio::test]` -# and keep the default. Give every process cargo runs the main-thread size, so -# `cargo test`, `cargo nextest run` and `cargo run` behave the same without an -# exported RUST_MIN_STACK. CI already passes at the default under the `ci` -# profile; this is for the debug profile every contributor runs. -[env] -RUST_MIN_STACK = "8388608" From 8f6369d7c527860c7cbb1803a908d1d0c0254cd0 Mon Sep 17 00:00:00 2001 From: EnRaiha <15997552+EnRaiha@users.noreply.github.com> Date: Thu, 17 Sep 2026 22:10:40 +0800 Subject: [PATCH 3/3] docs(test): document the CI stack size for local runs RUST_MIN_STACK replaces the default stack size for every thread that sets none, on every platform. Debug-profile test binaries overflow the 2 MiB default; 32 MiB is the value CI already sets in .github/workflows/test.yml. --- CONTRIBUTING.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 628d2473c..27bb0046b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -87,7 +87,8 @@ cd nodedb cargo build --release # Run the full test suite -cargo nextest run --all-features +# Debug-profile test binaries overflow the 2 MiB thread default; 32 MiB is the value CI sets. +RUST_MIN_STACK=33554432 cargo nextest run --all-features ``` **Why nextest, not `cargo test`?** The `.config/nextest.toml` defines a `cluster` test group that serializes 3-node integration tests and retries known-flaky ones. `cargo test` ignores all of that and will hang or fail on the cluster suite.