Skip to content

change spawned thread stack size to 8mb - #1509

Open
wjblanke wants to merge 1 commit into
release/0.45.1from
8mbstackwjb
Open

change spawned thread stack size to 8mb#1509
wjblanke wants to merge 1 commit into
release/0.45.1from
8mbstackwjb

Conversation

@wjblanke

@wjblanke wjblanke commented Aug 24, 2026

Copy link
Copy Markdown

DO NOT MERGE

testing stack size


Note

Medium Risk
Changes thread stack configuration for parallel CLVM/block and datalayer work. Larger stacks raise per-thread memory use and could still miss other thread pools.

Overview
Gives worker threads an 8MB stack instead of the default, to reduce stack overflows when running generators and related work.

chia-tools now exports THREAD_STACK_SIZE and applies it to the blocking_threadpool used by analyze-chain, gen-corpus, test-block-generators, and validate-blockchain-db (plus the compressed-block test).

Datalayer DeltaReader parallel blob collection no longer uses the global rayon pool. It installs a dedicated pool with the same 8MB stack.

Reviewed by Cursor Bugbot for commit 124f280. Bugbot is set up for automated code reviews on this repo. Configure here.

@cursor cursor Bot 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.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want fixes drafted automatically? Bugbot Autofix can create code changes for findings. A team admin can enable Autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 124f280. Configure here.

use std::sync::OnceLock;

/// Stack size for worker threads created by chia_rs.
const THREAD_STACK_SIZE: usize = 8 * 1024 * 1024;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Triplicated stack size constant risks silent drift

Low Severity

THREAD_STACK_SIZE is defined identically in three separate crates (chia-datalayer, chia-tools, and chia-consensus tests). If this value is later tuned in one location, the others will silently remain at 8 MiB, leading to inconsistent thread stack sizes across components. A shared workspace-level constant or a tiny shared crate would prevent drift.

Additional Locations (2)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 124f280. Configure here.

@coveralls-official

Copy link
Copy Markdown

Coverage Report for CI Build 32681834545

Warning

No base build found for commit 7fc6c44 on release/0.45.1.
Coverage changes can't be calculated without a base build.
If a base build is processing, this comment will update automatically when it completes.

Coverage: 80.984%

Details

  • Patch coverage: 25 of 25 lines across 2 files are fully covered (100%).

Uncovered Changes

No uncovered changes found.

Coverage Regressions

Requires a base build to compare against. How to fix this →


Coverage Stats

Coverage Status
Relevant Lines: 18616
Covered Lines: 15076
Line Coverage: 80.98%
Coverage Strength: 12127975.48 hits per line

💛 - Coveralls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant