Skip to content

Document the stack size local test runs need - #335

Merged
farhan-syah merged 1 commit into
mainfrom
chore/test-thread-stack-8mib
Sep 18, 2026
Merged

farhan-syah merged 1 commit into
mainfrom
chore/test-thread-stack-8mib

Conversation

@EnRaiha

@EnRaiha EnRaiha commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Why

Rust spawns threads at 2 MiB. Debug-profile test binaries overflow that default: at the default the native suite aborts with SIGABRT (measured on this branch), at 32 MiB it passes. CI already carries the fix — .github/workflows/test.yml:135 sets RUST_MIN_STACK: "33554432" for the test job, matching the margin nodedb-test-support/src/core_loop_runner.rs:7 documents — and a local run without the variable does not.

.cargo/config.toml was the first attempt and is removed per review: .gitignore:111 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. The value lives on the documented command line instead.

What changed

CONTRIBUTING.md, "Running tests" block — one comment sentence and the command:

# Run the full test suite
# 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

No config file. No product change.

Wording

RUST_MIN_STACK is not a floor. It replaces the default stack size for every std::thread::spawn that sets none, on every platform. 32 MiB matches the value CI sets.

Steps to test

  1. env -u RUST_MIN_STACK cargo nextest run -p nodedb --test native -E 'test(native_error_code_classification)' → aborts at the default (SIGABRT, rc=100). Re-measured on this branch.
  2. RUST_MIN_STACK=33554432 cargo nextest run -p nodedb --test native -E 'test(native_error_code_classification)' → 7 passed.
  3. RUST_MIN_STACK=33554432 cargo nextest run -p nodedb --test native -E 'test(vector_search_serializes_distance)' → 1 passed.

Exemption

No red-proof test: this change is documentation only and alters no product behaviour. No issue to close — the stack default is the task.

Copilot AI lite review requested due to automatic review settings September 17, 2026 06:27

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@EnRaiha EnRaiha added the run-ci Opt this PR into the full test suite; re-add to force a re-run label Sep 17, 2026

@farhan-syah farhan-syah left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Request changes.

Blocker: .cargo/config.toml is not committed in this repository. .gitignore ignores .cargo/ because that file is each contributor's local override ([build] jobs, [patch]). Tracking it makes every existing local copy a merge conflict on the next pull and turns every local edit into a permanent modification. git add -f around the ignore rule is not a fix. Remove the file from the PR.

Where the floor lives instead. CI already sets it: .github/workflows/test.yml exports RUST_MIN_STACK: "33554432" (32 MiB) for the test job, with the reason in the comment above it. The local run must match CI, so the change is one line in CONTRIBUTING.md, in the "Running tests" block next to cargo nextest run --all-features:

RUST_MIN_STACK=33554432 cargo nextest run --all-features

with one sentence on why (debug-profile stack depth, same value CI uses). No config file, no ignore change.

False claim, in the body and in the committed comment. "CI passes at the default because the ci profile has smaller frames" — CI never runs at the default. It runs at 32 MiB (test.yml, RUST_MIN_STACK).

Wrong value. 8 MiB is below the margin the tree documents: nodedb-test-support/src/core_loop_runner.rs states the OS-default 8 MiB blocking-thread stack overflows in debug builds and 32 MiB is sufficient. test.yml chose 32 MiB for that reason. The PR's ladder covers two tests.

Wording. RUST_MIN_STACK is not a floor. It replaces the default size for every std::thread::spawn that sets none, on every platform.

Checked statically against the branch ref. The steps-to-test were not re-run.

Comment thread .cargo/config.toml Outdated
Comment thread .cargo/config.toml Outdated
@EnRaiha EnRaiha changed the title Raise test thread stacks from 2 MiB to 8 MiB Document the stack size local test runs need Sep 17, 2026
@EnRaiha

EnRaiha commented Sep 17, 2026

Copy link
Copy Markdown
Contributor Author

Addressed and pushed (8f6369d7c) — the branch now changes CONTRIBUTING.md only.

  • Blocker, .cargo/config.toml: removed (94a427886). No config file, no ignore change.
  • Where the floor lives: CONTRIBUTING.md, "Running tests" block — one comment sentence plus RUST_MIN_STACK=33554432 cargo nextest run --all-features.
  • False claim: body rewritten. It now cites .github/workflows/test.yml:135 (32 MiB) and drops the "ci profile smaller frames" claim.
  • Wrong value: 32 MiB (33554432), matching core_loop_runner.rs.
  • Wording: body states RUST_MIN_STACK replaces the default stack size for every std::thread::spawn that sets none, on every platform.
  • Steps to test, re-run: at the default (env -u RUST_MIN_STACK) the native suite aborts (SIGABRT, rc=100); at 32 MiB native_error_code_classification 7/7 and vector_search_serializes_distance 1/1 pass.

No red-proof test: documentation-only change, stated under "Exemption" in the body.

@farhan-syah

Copy link
Copy Markdown
Member

Squash it, in one commit only

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 (.github/workflows/test.yml). The tracked .cargo/config.toml attempt is dropped: .gitignore ignores .cargo/ because that file is each contributor's local override.
@EnRaiha
EnRaiha force-pushed the chore/test-thread-stack-8mib branch from 8f6369d to 35a315a Compare September 17, 2026 22:50
@EnRaiha

EnRaiha commented Sep 17, 2026

Copy link
Copy Markdown
Contributor Author

Squashed to one commit, 35a315a5e, on top of a7f597257; force-pushed with lease. The tree matches the reviewed 8f6369d7c (git diff empty): CONTRIBUTING.md only. Preflight passes.

@farhan-syah
farhan-syah merged commit 2ff47d6 into main Sep 18, 2026
4 checks passed
@farhan-syah
farhan-syah deleted the chore/test-thread-stack-8mib branch September 18, 2026 11:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

run-ci Opt this PR into the full test suite; re-add to force a re-run

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants