worker_threads that use es modules incorrectly pause when loaded
まだ誰も着手していません。
- 主要言語
- JavaScript
- スター
- 122k
- フォーク
- 37.3k
- 平均マージ
- 4日 2時間
- マージ済み PR(30日)
- 283
説明
- Version: 16.0.0
- Platform: Win 10 x64
- Subsystem: inspector
What steps will reproduce the bug?
It's easiest to run under a debugger that supports worker threads, like VS Code's Node.js debugger. I've created an example repo here:
- Open the folder in VS Code
- In the debug view (play button on the left hand side), select "No Bug" and hit the play button. This runs
no-bug/index.js. - A worker thread spawns, logs its message, and exits
- Now select "Bug", and hit the play button. This runs
bug/index.js: the same code in an ES module. - The debugger pauses on the first line in the worker
How often does it reproduce? Is there a required condition?
100%
What is the expected behavior?
The debugger doesn't pause with ES modules
What do you see instead?
The debugger pauses
Additional information
It looks like Node.js is incorrectly reporting that the program is started with inspectBrk:

VS Code (and Webstorm I think, though I haven't tried to repro there) use a bootloader to inject ourselves into the process via NODE_OPTIONS. We don't actually invoke with --inspect-brk, we manually call inspector.waitForDebugger(). I'm guessing this triggers inspectBrk to be true, but I haven't debugged into it that far.
This was originally reported in https://github.com/microsoft/vscode/issues/122170
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
VS Code の Node.js デバッガーで bug/index.js と no-bug/index.js を使って問題を再現します。まず、inspector.waitForDebugger() の呼び出しと、関連付けられた VS Code bootloader の周辺における ES-module と non-module の worker の動作を比較します。ES-module のケースでデバッガーが worker の最初の行で停止しなくなれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- javascript, nodejs
- 領域
- devtools
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 静か
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 48/100