Skip to content

Commit 566a84a

Browse files
authored
Bump stack size on Windows (#1054)
* Bump stack size on Windows With e31ef2f (Default to current_thread tokio runtime, 2025-02-05) we converted the CLI to use the `current_thread` tokio executor. We had seen stack overflows on Windows in the past, which defaults to a 1 MiB stack. While this problem is not currently present, a PR that increases the depth of our call stack is encountering it in CI[0]. Add linker flags to bump the stack size to 8 MiB for both MSVC and MinGW, matching the default value of Linux and macOS. https://github.com/oxidecomputer/oxide.rs/actions/runs/13817821578/job/38655523269?pr=1053 * Don't spawn a task in main Now that the Windows stack size is increased there's no benefit to spawning a task.
1 parent 5c87518 commit 566a84a

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

.cargo/config.toml

+10
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,12 @@
11
[alias]
22
xtask = "run --package xtask --"
3+
4+
[target.x86_64-pc-windows-msvc]
5+
rustflags = [
6+
"-C", "link-args=/STACK:8388608",
7+
]
8+
9+
[target.x86_64-pc-windows-gnu]
10+
rustflags = [
11+
"-C", "link-arg=-Wl,--stack,8388608"
12+
]

cli/src/main.rs

+1-6
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,7 @@ pub fn make_cli() -> NewCli<'static> {
100100
async fn main() {
101101
let new_cli = make_cli();
102102

103-
// Spawn a task so we get this potentially chunky Future off the
104-
// main thread's stack.
105-
let result = tokio::spawn(async move { new_cli.run().await })
106-
.await
107-
.unwrap();
108-
if let Err(e) = result {
103+
if let Err(e) = new_cli.run().await {
109104
if let Some(io_err) = e.downcast_ref::<io::Error>() {
110105
if io_err.kind() == io::ErrorKind::BrokenPipe {
111106
return;

0 commit comments

Comments
 (0)