skipFiles does not suppress "uncaught" exceptions in web streams
まだ誰も着手していません。
- 主要言語
- JavaScript
- スター
- 122k
- フォーク
- 37.3k
- 平均マージ
- 4日 2時間
- マージ済み PR(30日)
- 283
説明
Version
22.4.1
Platform
Microsoft Windows NT 10.0.22635.0 x64
Subsystem
No response
What steps will reproduce the bug?
Run this code in the VSCode debugger with "skipFiles":["<node_internals>/**"] in the launch configuration.
import net from 'node:net';
import stream from 'node:stream';
const socket = net.connect('http://host.invalid.');
socket.on('error', (e) => {
console.error('Caught the error', e.message);
});
let myStream = stream.Duplex.toWeb(socket);
setTimeout(() => {
console.log('done');
}, 1000);
How often does it reproduce? Is there a required condition?
No response
What is the expected behavior? Why is that the expected behavior?
It is expected that the debugger won't trip. This promise rejection is entirely created and handled within node's internals and should be suppressed by the VSCode's skipFiles filter.
What do you see instead?
The debugger breaks when the promise is rejected.
The trace (given by console.trace) when it is rejected looks like:
Trace
at eval (eval-7c2224bb.repl:1:9)
at Object.reject (<anonymous>)
at writableStreamRejectCloseAndClosedPromiseIfNeeded (node:internal/webstreams/writablestream:771:28)
at writableStreamFinishErroring (node:internal/webstreams/writablestream:903:5)
at writableStreamStartErroring (node:internal/webstreams/writablestream:755:5)
at writableStreamDefaultControllerError (node:internal/webstreams/writablestream:1202:3)
at WritableStreamDefaultController.error (node:internal/webstreams/writablestream:502:5)
at Socket.<anonymous> (node:internal/webstreams/adapters:195:18)
at Socket.<anonymous> (node:internal/util:538:20)
at Socket.onclose (node:internal/streams/end-of-stream:152:25)
The stack on the error object is:
'AbortError: The operation was aborted
at handleKnownInternalErrors (node:internal/webstreams/adapters:111:14)
at Socket.<anonymous> (node:internal/webstreams/adapters:179:13)
at Socket.<anonymous> (node:internal/util:538:20)
at Socket.onclose (node:internal/streams/end-of-stream:152:25)
at Socket.emit (node:events:532:35)
at Pipe.<anonymous> (node:net:339:12)
at Pipe.callbackTrampoline (node:internal/async_hooks:130:17)'
Additional information
No response
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
skipFiles を有効にした状態で VSCode デバッガーで例を再現し、その後、node:internal/webstreams/writablestream と node:internal/webstreams/adapters を通じて拒否が伝播する経路を追跡します。この内部で生成された拒否に対するデバッガーの処理を、issue に表示されているスタックフレームと比較します。内部の拒否によって実行が中断されなくなり、関連するユーザーコードのエラーは引き続きデバッグ可能であれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- javascript, node.js
- 領域
- backend, devtools
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 静か
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 55/100