Skip to content

build,test: increase stack size limit on Windows#43632

Merged
nodejs-github-bot merged 1 commit intonodejs:mainfrom
tniessen:build-increase-thread-stack-size-limit-windows
Jul 2, 2022
Merged

build,test: increase stack size limit on Windows#43632
nodejs-github-bot merged 1 commit intonodejs:mainfrom
tniessen:build-increase-thread-stack-size-limit-windows

Conversation

@tniessen
Copy link
Copy Markdown
Member

Increase the virtual stack space available to each thread from 1 MiB to 8 MiB.

Fixes: #43630

@tniessen tniessen added windows Issues and PRs related to the Windows platform. build Issues and PRs related to build files or the CI. labels Jun 30, 2022
@nodejs-github-bot
Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/gyp

@nodejs-github-bot nodejs-github-bot added the needs-ci PRs that need a full CI run. label Jun 30, 2022
@tniessen tniessen force-pushed the build-increase-thread-stack-size-limit-windows branch from 598a8eb to 88fc47b Compare June 30, 2022 16:10
@tniessen tniessen added the request-ci Add this label to start a Jenkins CI on a PR. label Jun 30, 2022
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jun 30, 2022
@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot

This comment was marked as outdated.

@tniessen tniessen added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Jun 30, 2022
@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot
Copy link
Copy Markdown
Collaborator

@Trott Trott added the commit-queue Add this label to land a pull request using GitHub Actions. label Jul 2, 2022
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Jul 2, 2022
@nodejs-github-bot nodejs-github-bot merged commit 71691e5 into nodejs:main Jul 2, 2022
@nodejs-github-bot
Copy link
Copy Markdown
Collaborator

Landed in 71691e5

targos pushed a commit that referenced this pull request Jul 12, 2022
Fixes: #43630

PR-URL: #43632
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
targos pushed a commit that referenced this pull request Jul 20, 2022
Fixes: #43630

PR-URL: #43632
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
targos pushed a commit that referenced this pull request Jul 31, 2022
Fixes: #43630

PR-URL: #43632
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
guangwong pushed a commit to noslate-project/node that referenced this pull request Oct 10, 2022
Fixes: nodejs/node#43630

PR-URL: nodejs/node#43632
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
sbc100 added a commit to sbc100/emscripten that referenced this pull request Dec 2, 2023
On windows the default stack size is still limited to 1MB in older
versions of node.  See nodejs/node#43632 which
made it into v19.0.0.

Fixes: emscripten-core#17897
sbc100 added a commit to emscripten-core/emscripten that referenced this pull request Dec 4, 2023
On windows the default stack size is still limited to 1MB in older
versions of node.  See nodejs/node#43632 which
made it into v19.0.0.

Fixes: #17897
tniessen added a commit to tniessen/node-pqclean that referenced this pull request Mar 7, 2024
All supported Node.js release lines have increased the stack size on
Windows, so it is no longer necessary to use WebAssembly to access
certain algorithms on Windows.

Refs: nodejs/node#43632
data-wardenb6ym added a commit to data-wardenb6ym/node-pqclean that referenced this pull request Sep 29, 2025
All supported Node.js release lines have increased the stack size on
Windows, so it is no longer necessary to use WebAssembly to access
certain algorithms on Windows.

Refs: nodejs/node#43632
everest-an added a commit to edwin-hao-ai/AwarenessClaw that referenced this pull request Apr 8, 2026
…all paths

Stack-size changes:
- NODE_STACK_SIZE_KB unified to 8192 on all platforms (was 900 on Windows)
- The 900 value was based on nodejs/node#43630 which described a pre-v18.6
  limitation (1 MiB PE StackReserveSize). Node.js PR #43632 (merged July
  2022, backported to v18.6.0/v16.17.0) increased Windows StackReserveSize
  to 8 MiB, making --stack-size=8192 safe. Verified via PE header inspection
  of node.exe v22.22.1: StackReserve=0x800000 (8 MiB).
- shell-utils.ts comment updated to reference nodejs/node#43632.

Gateway patch extraction:
- patchGatewayCmdStackSize() extracted from main.ts to openclaw-config.ts as
  a shared utility (accepts homedir parameter instead of using module global).
- main.ts now imports and calls the shared function at all 3 existing sites.

Doctor gap fix:
- checks-infra.ts: patchGatewayCmdStackSize() now called after every
  'openclaw gateway install' (2 code paths) to prevent gateway.cmd from
  losing the --stack-size injection when the service is reinstalled.

Gateway restart hardening:
- All 'openclaw gateway restart' call sites now call
  patchGatewayCmdStackSize() on Windows before restarting, ensuring
  gateway.cmd always has --stack-size=8192 regardless of who regenerated it.
- Affected files: register-channel-config-handlers.ts (4 sites),
  register-channel-setup-handlers.ts (1 site),
  register-app-runtime-handlers.ts (1 site), checks-channels.ts (1 site).

Prior session changes included in this commit:
- channel-login-flow.ts: refactored to use runSpawn instead of cmd.exe shell
- shell-utils.ts: filesystem fast-path for getOpenClawPackageDirSync()
- register-channel-setup-handlers.ts: killStaleChannelLogins await fix
- register-runtime-health-handlers.ts, register-setup-handlers.ts: related
  test mock updates

Impact: All gateway start/restart/install paths on Windows now guarantee
--stack-size=8192, eliminating the AJV stack overflow (0xC00000FD) that
caused WeChat channel crashes. No behavioral change on macOS/Linux.

Verification: Electron tsconfig compilation passes. 562/567 tests pass
(5 failures are pre-existing in register-agent-handlers.test.ts due to
stale mock data, unrelated to this change).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs that have at least one approval, no pending requests for changes, and a CI started. build Issues and PRs related to build files or the CI. needs-ci PRs that need a full CI run. windows Issues and PRs related to the Windows platform.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Increase thread stack size limit on Windows

5 participants