[rush] rushd: cancelling rushx-client (Ctrl+C/SIGTERM) SIGKILLs the script without a graceful signal and exits 1 with "An unknown error occurred."
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 40/100
調査の方向性
The issue is in libraries/rush-daemon/src/GlobalCommandExecutionContext.ts, specifically the terminateChild method. Start by examining how requestCancel is handled and how signals are forwarded. Look at SubprocessTerminator.killProcessTree and the mapping in CommandResultPolicy.ts. The fix involves adding a graceful signal phase before SIGKILL, modifying the requestCancel payload to carry the signal, and adjusting exit codes. Test with a script that traps signals to verify graceful termination.
索引モデルが issue の本文から書いたものです。
説明
Summary
rushx-client forwards SIGINT/SIGTERM as requestCancel. The daemon then aborts the GlobalCommandExecutionContext, whose terminateChild immediately calls SubprocessTerminator.killProcessTree, which is process.kill(-pid, 'SIGKILL'). The script never receives SIGINT or SIGTERM. Dev servers leave lock/pid files and ports behind, and test runners skip teardown. RushXCommand then reports the killed shell as Error: An unknown error occurred., and the client exits 1 instead of 130/143.
Repro steps
Take a rushx script that traps SIGINT/SIGTERM/SIGHUP, writes a marker file, and exits 40.
| action | rushx-client (daemon) | native rushx |
|---|---|---|
| SIGINT to the client | exit 1, child SIGKILLed, trap not run, prints "Error: An unknown error occurred." | terminal Ctrl+C: trap runs, exit 130 |
| SIGTERM to the client | exit 1, trap not run, same message | exit 143 |
To its credit, the daemon kills the whole tree, so no orphans are left behind.
Expected result: Emulate a terminal Ctrl+C. Send the same signal (SIGINT/SIGTERM) to the script's process group, wait a bounded grace period (for example 2-5 s, within the client's cancellation timeout), then SIGKILL. The client exits 128 + signo and does not print a bogus "unknown error".
Actual result: The script is killed immediately with SIGKILL, the client exits 1, and the message is misleading.
Details
Root cause (main @ 60007c9a8c): libraries/rush-daemon/src/GlobalCommandExecutionContext.ts:343-355 (terminateChild) calls killProcessTree (SIGKILL) directly. CommandResultPolicy.ts:65-68 maps the result to exit code 1.
Suggested fix: add a graceful phase: process.kill(-child.pid, requestSignal ?? 'SIGINT'), then killProcessTree after a grace timeout. Carry the client's signal in requestCancel (for example an additive optional signal field). Suppress the "unknown error" message for aborted requests, and return 130/143 (related: #6060, for phased builds).
This was found during an automated performance/behavior analysis of rush-client/rushd on Linux and independently reproduced.
Standard questions
| Question | Answer |
|---|---|
@microsoft/rush globally installed version? |
built from main @ 60007c9a8c (5.179.0) |
rushVersion from rush.json? |
5.179.0 |
pnpmVersion, npmVersion, or yarnVersion from rush.json? |
[email protected] |
(if pnpm) useWorkspaces from pnpm-config.json? |
true |
| Operating system? | Linux (WSL2 Ubuntu 24.04) |
| Would you consider contributing a PR? | Yes |
Node.js version (node -v)? |
22.23.2 |
- 主要言語
- TypeScript
- スター
- 6.5k
- フォーク
- 708
- 平均マージ
- 4日 13時間
- マージ済み PR(30日)
- 62
環境構築
このプロジェクトの環境構築ファイルはまだ確認していません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
microsoft/rushstack のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
microsoft/rushstack#5971 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
microsoft/rushstack#5902 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
microsoft/rushstack#5839 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
microsoft/rushstack#5683 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
メンテナーはふだん 1 日以内に返信
microsoft/rushstack の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
diegosouzapw/OmniRoute#14869 ·
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 94/100
メンテナーはふだん 1 日以内に返信
-
status: waiting triage
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
freeCodeCamp/freeCodeCamp#70412 ·
メンテナーはふだん 1 日以内に返信
-
Mend: dependency security vulnerability untriaged
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
opensearch-project/OpenSearch-Dashboards#12816 ·
メンテナーはふだん 1 日以内に返信