skipFiles does not suppress "uncaught" exceptions in web streams
还没有人认领这个 Issue。
- 主要语言
- JavaScript
- 星标
- 122k
- 派生
- 37.3k
- 平均合并
- 4 天 2 小时
- 30 天内合并 PR
- 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 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 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