Skip to content

fix: run main body on a 16 MiB worker thread (Windows stack) (0.26.1)#48

Merged
Shahinyanm merged 1 commit into
mainfrom
fix/main-larger-stack-thread
Jun 14, 2026
Merged

fix: run main body on a 16 MiB worker thread (Windows stack) (0.26.1)#48
Shahinyanm merged 1 commit into
mainfrom
fix/main-larger-stack-thread

Conversation

@Shahinyanm

Copy link
Copy Markdown
Member

Why

#47 hit STATUS_STACK_OVERFLOW (code -1073741571) on Windows: the binary crashed at startup on every command because the giant CLI command dispatch in main sits near Windows' 1 MiB main-thread stack and one added branch tipped it over. Linux/macOS (8 MiB stack) were unaffected. #47 fixed the immediate case by extracting a branch; this removes the underlying time-bomb.

Change

main now spawns the real work (real_main) on a worker thread with a 16 MiB stack, then joins and propagates the result. The dispatch can grow safely; a future added branch can't re-overflow it.

  • Exit codes preserved: verified --version → 0, complete tj-nope (bail) → 1, invalid arg → 1.
  • std::process::exit(...) paths still terminate the process from the worker thread.
  • Panics propagate (join error → non-zero exit).

Tests

Full test --workspace green (the integration suite exercises many commands and asserts .success()/.failure() exit codes through the wrapper). The real proof is Windows CI passing.

🤖 Generated with Claude Code

The command dispatch sits near Windows' 1 MiB main-thread stack limit —
a single added branch overflowed it (STATUS_STACK_OVERFLOW at startup on
every command). Move the real work into real_main() and run it on a
16 MiB worker thread so the dispatch can grow safely and this can't
recur. Exit codes and panics propagate (verified: success=0, bail=1).

claude-memory-65t

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Shahinyanm Shahinyanm merged commit cf1a068 into main Jun 14, 2026
7 checks passed
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