Skip to content

Commit f03b1df

Browse files
authored
docs: note native addons can crash the threads pool (#1365)
1 parent f816075 commit f03b1df

3 files changed

Lines changed: 3 additions & 2 deletions

File tree

scripts/dictionary.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ bundleless
1414
bytedance
1515
caniuse
1616
canyonjs
17+
catchable
1718
cdup
1819
CEHQ
1920
chunkhash

website/docs/en/config/test/pool.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ Consider switching to `threads` when:
6969
Stick with `forks` when:
7070

7171
- Your tests mutate `process.chdir`, env vars, or signal handlers and rely on per-file isolation.
72-
- Your project depends on native modules that assume per-process initialization (e.g. `better-sqlite3`, `sharp`, `canvas`).
72+
- Your project uses native addons (e.g. `better-sqlite3`, `sharp`, `canvas`) — one not built for worker threads can abort the whole run under `threads` (`SIGSEGV` / `SIGABRT`, not a catchable error).
7373
- You want a hard crash in one test file contained inside its own worker, without risking the parent process or sibling tests.
7474

7575
## Control file-level parallelism

website/docs/zh/config/test/pool.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ Rstest 支持两种 pool 类型,它们共享同一套 scheduler、RPC 和结
6969
下列情况建议继续使用 `forks`
7070

7171
- 测试里会修改 `process.chdir`、环境变量、signal handler 等进程级状态,并依赖按文件之间互相隔离。
72-
- 项目依赖按进程初始化的 native module(如 `better-sqlite3``sharp``canvas`)。
72+
- 项目使用 native addon(如 `better-sqlite3``sharp``canvas`)—— 未针对 worker thread 设计的 addon 在 `threads` 下可能让整个运行直接 abort(`SIGSEGV` / `SIGABRT`,且无法捕获)。
7373
- 希望单个测试文件的硬性崩溃被限制在该 worker 内,不影响主进程和其他用例。
7474

7575
## 控制文件级并行度

0 commit comments

Comments
 (0)