fix: raise RUST_MIN_STACK repo-wide to fix e2e test stack overflows#3455
Open
wbbradley wants to merge 1 commit into
Open
fix: raise RUST_MIN_STACK repo-wide to fix e2e test stack overflows#3455wbbradley wants to merge 1 commit into
wbbradley wants to merge 1 commit into
Conversation
E2e tests build deep async call chains through the Sui SDK futures (Wallet::execute_transaction_may_fail and friends are ~10 KB stack frames each), which compose past the default thread stack and abort with `fatal runtime error: stack overflow` when run via --run-ignored. Set RUST_MIN_STACK to 32 MiB via a workspace-root .cargo/config.toml [env] table. Cargo applies this to all launched processes (test binaries under cargo test and cargo nextest run, build scripts, cargo run), so it is honored locally and in CI uniformly with no per-invocation env var. The libtest harness runs each test on its own spawned thread, which honors RUST_MIN_STACK at creation time. Non-force, so a developer who already exports RUST_MIN_STACK keeps their own value.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
E2e tests (
test_blob_attribute_add_and_remove,test_byte_range_read_client,test_aggregator_blob_endpoints_corner_cases, and others run via--run-ignored) abort withfatal runtime error: stack overflowwhen built with the default debug profile (opt-level = 0), for example a plain localcargo nextest run --run-ignored ....The root cause is deep async call chains through the Sui SDK futures (
Wallet::execute_transaction_may_fail≈ 10 KB,WalletContext::execute_transaction_may_fail≈ 9.7 KB, and friends). In debug builds these frames are large and un-inlined, so they compose past the default thread stack.This is a local-only issue, not a CI failure
CI is not affected and is green on
main. Thetestjob runs with--cargo-profile test-opt(Cargo.toml:202,opt-level = 1), which shrinks those stack frames enough to stay under the default stack even though it runs the same--run-ignored alle2e tests. The real axis is debug-vs-optimized builds, not macOS-vs-Linux.Fix
Add a workspace-root
.cargo/config.tomlwith a Cargo[env]table settingRUST_MIN_STACKto 32 MiB. This lets developers run the e2e suite with a default debug build without manually exportingRUST_MIN_STACKper invocation. Cargo applies[env]to all processes it launches (test binaries under bothcargo testandcargo nextest run, build scripts,cargo run), so it is honored uniformly. The value is non-force, so a developer who already exportsRUST_MIN_STACKkeeps their own value.The libtest harness runs each test on its own spawned thread (the overflow message names the thread after the test, for example
thread 'deep_stack' has overflowed its stack), and that thread honorsRUST_MIN_STACKat creation time.cargo-nextest0.9.108 propagates the Cargo[env]table into the test process.Why this over alternatives
-Wl,-stack_size/-Wl,-z,stacksize): only reliably resize the main thread stack on macOS, and tests don't run on the main thread anyway — so they wouldn't help the per-test spawned threads where the overflow actually occurs.multi_thread, worker_threads = 1: changes async test semantics workspace-wide — risky and broad for no benefit.RUST_MIN_STACKexport: easy to forget and undocumented;.cargo/config.tomlmakes it automatic and discoverable.Notes
cargo run).Verification
chk— clean (config-only change; no compiler impact).cargo nextest run— 1106 tests passed, no regressions.🤖 Generated with Claude Code