Skip to content

fix(windows): increase stack size to resolve runtime overflow#2591

Closed
killf wants to merge 1 commit intozeroclaw-labs:mainfrom
killf:fix/windows-stack-size
Closed

fix(windows): increase stack size to resolve runtime overflow#2591
killf wants to merge 1 commit intozeroclaw-labs:mainfrom
killf:fix/windows-stack-size

Conversation

@killf
Copy link
Copy Markdown

@killf killf commented Mar 2, 2026

Problem

Running cargo run --bin zeroclaw on Windows fails with:

thread 'main' has overflowed its stack
error: process didn't exit successfully (exit code: 0xc00000fd, STATUS_STACK_OVERFLOW)

Root Cause

Windows platforms have a default stack size (1-2MB) that is insufficient for:

  • 133 JsonSchema derives in src/config/schema.rs
  • Large trait implementations generated by schemars library at compile time

Solution

Increase stack size to 8MB for Windows targets in .cargo/config.toml:

[target.x86_64-pc-windows-msvc]
rustflags = ["-C", "link-args=/STACK:8388608"]

[target.aarch64-pc-windows-msvc]
rustflags = ["-C", "link-args=/STACK:8388608"]

Changes

  • βœ… Add 8MB stack size for x86_64-pc-windows-msvc
  • βœ… Add 8MB stack size for aarch64-pc-windows-msvc
  • βœ… Remove unused ErrorKind import in src/update.rs

Testing

cargo run --bin zeroclaw -- --version  # βœ… Works
cargo run --bin zeroclaw -- status      # βœ… Works

Fixes: Windows runtime stack overflow on program startup

Summary by CodeRabbit

  • Chores
    • Updated Windows MSVC build configuration for x86_64 and ARM64 platforms.
    • Appended new Windows MSVC targets to existing build configurations while leaving non-Windows targets unchanged.
    • No changes to public APIs or exported entities; build adjustments only.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 2, 2026

PR intake checks found warnings (non-blocking)

Fast safe checks found advisory issues. CI lint/test/build gates still enforce merge quality.

  • Missing required PR template sections: ## Validation Evidence (required), ## Security Impact (required), ## Privacy and Data Hygiene (required), ## Rollback Plan (required)
  • Incomplete required PR template fields: summary problem, summary why it matters, summary what changed, validation commands, security risk/mitigation, privacy status, rollback plan
  • Missing Linear issue key reference (RMN-<id>, CDV-<id>, or COM-<id>) in PR title/body (recommended for traceability, non-blocking).

Action items:

  1. Complete required PR template sections/fields.
  2. (Recommended) Link this PR to one active Linear issue key (RMN-xxx/CDV-xxx/COM-xxx) for traceability.
  3. Remove tabs, trailing whitespace, and merge conflict markers from added lines.
  4. Re-run local checks before pushing:
    • ./scripts/ci/rust_quality_gate.sh
    • ./scripts/ci/rust_strict_delta_gate.sh
    • ./scripts/ci/docs_quality_gate.sh

Detected Linear keys: none

Run logs: https://github.com/zeroclaw-labs/zeroclaw/actions/runs/22611104404

Detected blocking line issues (sample):

  • none

Detected advisory line issues (sample):

  • none

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 2, 2026

Note

.coderabbit.yaml has unrecognized properties

CodeRabbit is using all valid settings from your configuration. Unrecognized properties (listed below) have been ignored and may indicate typos or deprecated fields that can be removed.

⚠️ Parsing warnings (1)
Validation error: Unrecognized key(s) in object: 'tools', 'path_filters', 'review_instructions'
βš™οΈ Configuration instructions
  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

No actionable comments were generated in the recent review. πŸŽ‰

ℹ️ Recent review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between fccdfab and 1e4fc3c.

πŸ“’ Files selected for processing (1)
  • .cargo/config.toml
🚧 Files skipped from review as they are similar to previous changes (1)
  • .cargo/config.toml

πŸ“ Walkthrough

Walkthrough

Adds two Windows MSVC Rust target configurations in .cargo/config.toml that set rustflags to pass a linker argument increasing stack size to 8,388,608 bytes for x86_64 and aarch64 Windows targets.

Changes

Cohort / File(s) Summary
Cargo configuration
​.cargo/config.toml
Appended [target.x86_64-pc-windows-msvc] and [target.aarch64-pc-windows-msvc] sections with rustflags = ["-C", "link-args=/STACK:8388608"] to increase Windows MSVC stack size.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Suggested labels

bug, risk: medium, config: core, runtime: native

Suggested reviewers

  • theonlyhennygod
  • chumyin
πŸš₯ Pre-merge checks | βœ… 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is significantly incomplete against the required template. It lacks required sections including Label Snapshot, Change Metadata, Linked Issue, Validation Evidence, Security Impact, Privacy/Data Hygiene, Compatibility, i18n Follow-Through, Human Verification, Side Effects, Rollback Plan, and Risks/Mitigations. Complete the description by filling in all required sections from the template, particularly the mandatory sections: Label Snapshot, Change Metadata, Linked Issue, Validation Evidence, Security Impact, Privacy/Data Hygiene, Compatibility, Human Verification, Side Effects, Rollback Plan, and Risks/Mitigations.
βœ… Passed checks (2 passed)
Check name Status Explanation
Title check βœ… Passed The title accurately describes the main change: increasing stack size to fix Windows runtime overflow, which directly addresses the core problem solved in this PR.
Docstring Coverage βœ… Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
πŸ§ͺ Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added size: XS Auto size: <=80 non-doc changed lines. risk: low Auto risk: docs/chore-only paths. trusted contributor Contributor with 5+ merged PRs. labels Mar 2, 2026
Windows platforms have a default stack size (1-2MB) that is too small
for the heavy JsonSchema derives in config/schema.rs (133 derives).
This causes "thread 'main' has overflowed its stack" on startup.

Changes:
- Increase stack size to 8MB for x86_64-pc-windows-msvc
- Increase stack size to 8MB for aarch64-pc-windows-msvc
- Remove unused ErrorKind import in src/update.rs

Fixes: cargo run --bin zeroclaw stack overflow on Windows
@killf killf force-pushed the fix/windows-stack-size branch from fccdfab to 1e4fc3c Compare March 3, 2026 06:23
@killf killf requested a review from chumyin March 3, 2026 06:53
@killf killf self-assigned this Mar 3, 2026
@killf killf changed the base branch from main to dev March 3, 2026 06:58
@killf killf changed the base branch from dev to main March 3, 2026 06:58
@killf
Copy link
Copy Markdown
Author

killf commented Mar 3, 2026

Closing as this issue has been resolved by commit c8dbcd0 on the dev branch.

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

Labels

risk: low Auto risk: docs/chore-only paths. size: XS Auto size: <=80 non-doc changed lines. trusted contributor Contributor with 5+ merged PRs.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant