nodejs / nodejs/node

Unreachable code reached, Cannot toggle network tracking

未关闭
#64,308 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
JavaScript
星标
122k
派生
37.4k
平均合并
4 天 3 小时
30 天内合并 PR
272

描述

Version

v26.4.0

Platform
Darwin Local-pc 25.5.0 Darwin Kernel Version 25.5.0: Tue Jun  9 22:26:15 PDT 2026; root:xnu-12377.121.10~1/RELEASE_ARM64_T6031 arm64
Subsystem

No response

What steps will reproduce the bug?

Run a script with --inspect-wait=0.0.0.0:9229 --experimental-network-inspection enabled.
The debugger which is attaching is from vscode

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Test",
      "type": "node",
      "request": "attach",
      "port": 9229,
      "restart": true,
      "address": "localhost"
    }
  ]
}

full command

node --inspect-wait=0.0.0.0:9229 --experimental-network-inspection --env-file=.env -r ts-node/register/transpile-only index.ts
How often does it reproduce? Is there a required condition?

Its very flaky and happens out of random.

What is the expected behavior? Why is that the expected behavior?

Nodejs process is crashing due to unexpected condition. Application should boot properly and not crash immediately.

What do you see instead?
Debugger attached.
node:internal/worker/io:250
class ReadableWorkerStdio extends Readable {
                                  ^

TypeError: Class extends value undefined is not a constructor or null
    at node:internal/worker/io:250:35
    at compileForInternalLoader (node:internal/bootstrap/realm:407:7)
    at requireBuiltin (node:internal/bootstrap/realm:438:14)
    at node:internal/worker:48:18
    at compileForInternalLoader (node:internal/bootstrap/realm:407:7)
    at requireBuiltin (node:internal/bootstrap/realm:438:14)
    at node:worker_threads:13:5
    at compileForInternalLoader (node:internal/bootstrap/realm:407:7)
    at requireBuiltin (node:internal/bootstrap/realm:438:14)
    at node:inspector:37:26
    at compileForInternalLoader (node:internal/bootstrap/realm:407:7)
    at requireBuiltin (node:internal/bootstrap/realm:438:14)
    at node:internal/inspector/network_http:20:21
    at compileForInternalLoader (node:internal/bootstrap/realm:407:7)
    at requireBuiltin (node:internal/bootstrap/realm:438:14)
    at enable (node:internal/inspector_network_tracking:4:3)
    at node:internal/streams/readable:1:1
    at compileForInternalLoader (node:internal/bootstrap/realm:407:7)
    at requireBuiltin (node:internal/bootstrap/realm:438:14)
    at node:internal/streams/duplex:39:18
    at compileForInternalLoader (node:internal/bootstrap/realm:407:7)
    at requireBuiltin (node:internal/bootstrap/realm:438:14)
    at node:internal/streams/pipeline:16:16
    at compileForInternalLoader (node:internal/bootstrap/realm:407:7)
    at requireBuiltin (node:internal/bootstrap/realm:438:14)
    at node:internal/streams/compose:7:22
    at compileForInternalLoader (node:internal/bootstrap/realm:407:7)
    at requireBuiltin (node:internal/bootstrap/realm:438:14)
    at node:stream:44:17
    at compileForInternalLoader (node:internal/bootstrap/realm:407:7)
    at requireBuiltin (node:internal/bootstrap/realm:438:14)
    at node:net:45:16
    at compileForInternalLoader (node:internal/bootstrap/realm:407:7)
    at compileForPublicLoader (node:internal/bootstrap/realm:346:10)
    at loadBuiltinModule (node:internal/modules/helpers:128:7)
    at loadBuiltinWithHooks (node:internal/modules/cjs/loader:1301:15)
    at node:internal/modules/cjs/loader:1396:48
    at wrapModuleLoad (node:internal/modules/cjs/loader:260:19)
    at node:internal/modules/cjs/loader:1689:12
    at require (node:internal/modules/helpers:191:16)
    at <REDACTED>index.js:21:13
    at node:internal/modules/cjs/loader:1944:14
    at node:internal/modules/cjs/loader:2084:10
    at node:internal/modules/cjs/loader:1666:32
    at node:internal/modules/cjs/loader:1447:12
    at wrapModuleLoad (node:internal/modules/cjs/loader:260:19)
    at node:internal/modules/cjs/loader:1689:12
    at node:internal/modules/cjs/loader:2245:12
    at loadPreloadModules (node:internal/process/pre_execution:774:5)
    at initializeModuleLoaders (node:internal/process/pre_execution:246:5)
    at prepareExecution (node:internal/process/pre_execution:174:5)
    at prepareMainThreadExecution (node:internal/process/pre_execution:46:10)
    at node:internal/main/run_main_module:15:19

  #  node[29371]: void node::inspector::Agent::ToggleNetworkTracking(Isolate *, Local<Function>) at ../src/inspector_agent.cc:1023
  #  Assertion failed: "Unreachable code reached" ": " "Cannot toggle network tracking, please report this."

----- Native stack trace -----

 1: 0x10affa930 node::Assert(node::AssertionInfo const&) [/opt/homebrew/Cellar/node/26.4.0/lib/libnode.147.dylib]
 2: 0x109e7d944 node::inspector::Agent::ToggleNetworkTracking(v8::Isolate*, v8::Local<v8::Function>) [/opt/homebrew/Cellar/node/26.4.0/lib/libnode.147.dylib]
 3: 0x10b064984 node::inspector::Agent::EnableNetworkTracking() (.cold.1) [/opt/homebrew/Cellar/node/26.4.0/lib/libnode.147.dylib]
 4: 0x109e7d7f0 node::inspector::Agent::EnableNetworkTracking() [/opt/homebrew/Cellar/node/26.4.0/lib/libnode.147.dylib]
 5: 0x109e92708 node::inspector::NetworkInspector::Enable() [/opt/homebrew/Cellar/node/26.4.0/lib/libnode.147.dylib]
 6: 0x109e932e8 node::inspector::NetworkAgent::enable(std::__1::optional<int>, std::__1::optional<int>) [/opt/homebrew/Cellar/node/26.4.0/lib/libnode.147.dylib]
 7: 0x109f03d80 node::inspector::protocol::Network::DomainDispatcherImpl::enable(crdtp::Dispatchable const&) [/opt/homebrew/Cellar/node/26.4.0/lib/libnode.147.dylib]
 8: 0x10a9d86d0 crdtp::UberDispatcher::DispatchResult::Run() [/opt/homebrew/Cellar/node/26.4.0/lib/libnode.147.dylib]
 9: 0x10b06455c node::inspector::NodeInspectorClient::dispatchMessageFromFrontend(int, v8_inspector::StringView const&) [/opt/homebrew/Cellar/node/26.4.0/lib/libnode.147.dylib]
10: 0x109e7fca4 node::inspector::(anonymous namespace)::SameThreadInspectorSession::Dispatch(v8_inspector::StringView const&) [/opt/homebrew/Cellar/node/26.4.0/lib/libnode.147.dylib]
11: 0x109e8d6e4 node::inspector::(anonymous namespace)::MainThreadSessionState::Dispatch(std::__1::unique_ptr<v8_inspector::StringBuffer, std::__1::default_delete<v8_inspector::StringBuffer>>) [/opt/home
12: 0x109e8d728 void node::inspector::(anonymous namespace)::AnotherThreadObjectReference<node::inspector::(anonymous namespace)::MainThreadSessionState>::Apply<std::__1::unique_ptr<v8_inspector::StringB
13: 0x109e8ca14 node::inspector::MainThreadInterface::DispatchMessages() [/opt/homebrew/Cellar/node/26.4.0/lib/libnode.147.dylib]
14: 0x109e8dcd4 node::CallbackQueue<void, node::Environment*>::CallbackImpl<node::inspector::MainThreadInterface::Post(std::__1::unique_ptr<node::inspector::Request, std::__1::default_delete<node::inspec
15: 0x109d2d7e0 node::Environment::RunAndClearInterrupts() [/opt/homebrew/Cellar/node/26.4.0/lib/libnode.147.dylib]
16: 0x109d31304 node::Environment::RequestInterruptFromV8()::$_0::__invoke(v8::Isolate*, void*) [/opt/homebrew/Cellar/node/26.4.0/lib/libnode.147.dylib]
17: 0x10a033c58 v8::internal::Isolate::InvokeApiInterruptCallbacks() [/opt/homebrew/Cellar/node/26.4.0/lib/libnode.147.dylib]
18: 0x10a049b64 v8::internal::StackGuard::HandleInterrupts(v8::internal::StackGuard::InterruptLevel) [/opt/homebrew/Cellar/node/26.4.0/lib/libnode.147.dylib]
19: 0x10a3c2810 v8::internal::Runtime_StackGuard(int, unsigned long*, v8::internal::Isolate*) [/opt/homebrew/Cellar/node/26.4.0/lib/libnode.147.dylib]
20: 0x10a84ccac Builtins_CEntry_Return1_ArgvOnStack_NoBuiltinExit [/opt/homebrew/Cellar/node/26.4.0/lib/libnode.147.dylib]
21: 0x10a7a94c8 Builtins_InterpreterEntryTrampoline [/opt/homebrew/Cellar/node/26.4.0/lib/libnode.147.dylib]
22: 0x11c780610
23: 0x11c7802b4
24: 0x10a7a9424 Builtins_InterpreterEntryTrampoline [/opt/homebrew/Cellar/node/26.4.0/lib/libnode.147.dylib]
25: 0x11c780610
26: 0x11c7802b4
27: 0x10a7a9424 Builtins_InterpreterEntryTrampoline [/opt/homebrew/Cellar/node/26.4.0/lib/libnode.147.dylib]
28: 0x11c780610
29: 0x11c7802b4
30: 0x10a7a9424 Builtins_InterpreterEntryTrampoline [/opt/homebrew/Cellar/node/26.4.0/lib/libnode.147.dylib]
31: 0x11c780610
32: 0x11c7802b4
33: 0x10a7a9424 Builtins_InterpreterEntryTrampoline [/opt/homebrew/Cellar/node/26.4.0/lib/libnode.147.dylib]
34: 0x11c780610
35: 0x11c7802b4
36: 0x10a7a9424 Builtins_InterpreterEntryTrampoline [/opt/homebrew/Cellar/node/26.4.0/lib/libnode.147.dylib]
37: 0x11c780610
38: 0x10a7a9424 Builtins_InterpreterEntryTrampoline [/opt/homebrew/Cellar/node/26.4.0/lib/libnode.147.dylib]
39: 0x10a7a9424 Builtins_InterpreterEntryTrampoline [/opt/homebrew/Cellar/node/26.4.0/lib/libnode.147.dylib]
40: 0x10a7a9424 Builtins_InterpreterEntryTrampoline [/opt/homebrew/Cellar/node/26.4.0/lib/libnode.147.dylib]
41: 0x10a7a9424 Builtins_InterpreterEntryTrampoline [/opt/homebrew/Cellar/node/26.4.0/lib/libnode.147.dylib]
42: 0x10a7a9424 Builtins_InterpreterEntryTrampoline [/opt/homebrew/Cellar/node/26.4.0/lib/libnode.147.dylib]
43: 0x10a7a9424 Builtins_InterpreterEntryTrampoline [/opt/homebrew/Cellar/node/26.4.0/lib/libnode.147.dylib]
44: 0x10a7a9424 Builtins_InterpreterEntryTrampoline [/opt/homebrew/Cellar/node/26.4.0/lib/libnode.147.dylib]
45: 0x10a7a9424 Builtins_InterpreterEntryTrampoline [/opt/homebrew/Cellar/node/26.4.0/lib/libnode.147.dylib]
46: 0x10a7a9424 Builtins_InterpreterEntryTrampoline [/opt/homebrew/Cellar/node/26.4.0/lib/libnode.147.dylib]
47: 0x10a7a9424 Builtins_InterpreterEntryTrampoline [/opt/homebrew/Cellar/node/26.4.0/lib/libnode.147.dylib]
48: 0x10a7a9424 Builtins_InterpreterEntryTrampoline [/opt/homebrew/Cellar/node/26.4.0/lib/libnode.147.dylib]
49: 0x10a7a9424 Builtins_InterpreterEntryTrampoline [/opt/homebrew/Cellar/node/26.4.0/lib/libnode.147.dylib]
50: 0x10a7a9424 Builtins_InterpreterEntryTrampoline [/opt/homebrew/Cellar/node/26.4.0/lib/libnode.147.dylib]
51: 0x10a7a9424 Builtins_InterpreterEntryTrampoline [/opt/homebrew/Cellar/node/26.4.0/lib/libnode.147.dylib]
52: 0x10a7a9424 Builtins_InterpreterEntryTrampoline [/opt/homebrew/Cellar/node/26.4.0/lib/libnode.147.dylib]
53: 0x10a7a9424 Builtins_InterpreterEntryTrampoline [/opt/homebrew/Cellar/node/26.4.0/lib/libnode.147.dylib]
54: 0x10a7a9424 Builtins_InterpreterEntryTrampoline [/opt/homebrew/Cellar/node/26.4.0/lib/libnode.147.dylib]
55: 0x10a7a9424 Builtins_InterpreterEntryTrampoline [/opt/homebrew/Cellar/node/26.4.0/lib/libnode.147.dylib]
56: 0x10a7a9424 Builtins_InterpreterEntryTrampoline [/opt/homebrew/Cellar/node/26.4.0/lib/libnode.147.dylib]
57: 0x10a7a9424 Builtins_InterpreterEntryTrampoline [/opt/homebrew/Cellar/node/26.4.0/lib/libnode.147.dylib]
58: 0x10a7a6788 Builtins_JSEntryTrampoline [/opt/homebrew/Cellar/node/26.4.0/lib/libnode.147.dylib]
59: 0x10a7a6478 Builtins_JSEntry [/opt/homebrew/Cellar/node/26.4.0/lib/libnode.147.dylib]
60: 0x10a025090 v8::internal::(anonymous namespace)::Invoke(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) [/opt/homebrew/Cellar/node/26.4.0/lib/libnode.147.dylib]
61: 0x10a024ac8 v8::internal::Execution::Call(v8::internal::Isolate*, v8::internal::DirectHandle<v8::internal::Object>, v8::internal::DirectHandle<v8::internal::Object>, v8::base::Vector<v8::internal::DirectHandle<v8::internal::Object> const>) [/opt/homebrew/Cellar/node/26.4.0/lib/libnode.147.dylib]
62: 0x10b0943d0 v8::Function::Call(v8::Isolate*, v8::Local<v8::Context>, v8::Local<v8::Value>, int, v8::Local<v8::Value>*) [/opt/homebrew/Cellar/node/26.4.0/lib/libnode.147.dylib]
63: 0x109d6317c node::builtins::BuiltinLoader::CompileAndCall(v8::Local<v8::Context>, char const*, node::Realm*) [/opt/homebrew/Cellar/node/26.4.0/lib/libnode.147.dylib]
64: 0x10b02268c node::Realm::ExecuteBootstrapper(char const*) [/opt/homebrew/Cellar/node/26.4.0/lib/libnode.147.dylib]
65: 0x10afe6d28 node::StartExecution(node::Environment*, char const*) (.cold.1) [/opt/homebrew/Cellar/node/26.4.0/lib/libnode.147.dylib]
66: 0x109d4e3b8 node::StartExecution(node::Environment*, char const*) [/opt/homebrew/Cellar/node/26.4.0/lib/libnode.147.dylib]
67: 0x109d4e350 node::StartExecution(node::Environment*, std::__1::function<v8::MaybeLocal<v8::Value> (node::StartExecutionCallbackInfoWithModule const&)>) [/opt/homebrew/Cellar/node/26.4.0/lib/libnode.147.dylib]
68: 0x109cdd138 node::LoadEnvironment(node::Environment*, std::__1::function<v8::MaybeLocal<v8::Value> (node::StartExecutionCallbackInfoWithModule const&)>, std::__1::function<void (node::Environment*, v8::Local<v8::Value>, v8::Local<v8::Value>)>) [/opt/homebrew/Cellar/node/26.4.0/lib/libnode.147.dylib]
69: 0x109db009c node::NodeMainInstance::Run(node::ExitCode*, node::Environment*) [/opt/homebrew/Cellar/node/26.4.0/lib/libnode.147.dylib]
70: 0x109dafe2c node::NodeMainInstance::Run() [/opt/homebrew/Cellar/node/26.4.0/lib/libnode.147.dylib]
71: 0x109d50e04 node::Start(int, char**) [/opt/homebrew/Cellar/node/26.4.0/lib/libnode.147.dylib]
72: 0x1894fbe00 start [/usr/lib/dyld]

----- JavaScript stack trace -----

1: node:internal/streams/readable:1:1
2: compileForInternalLoader (node:internal/bootstrap/realm:407:7)
3: requireBuiltin (node:internal/bootstrap/realm:438:14)
4: node:internal/streams/duplex:39:18
5: compileForInternalLoader (node:internal/bootstrap/realm:407:7)
6: requireBuiltin (node:internal/bootstrap/realm:438:14)
7: node:internal/streams/pipeline:16:16
8: compileForInternalLoader (node:internal/bootstrap/realm:407:7)
9: requireBuiltin (node:internal/bootstrap/realm:438:14)
10: node:internal/streams/compose:7:22

Additional information

This i tried with node24 as well and was reproducible.
With --experimental-network-inspection removed this does not happen, so seems like only that is causing issue

REDACTED part

L20 const fs = require('fs');
L21 const net = require('net');
L22 const async_hooks = require('async_hooks');

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

在启用 inspector 和网络检查的情况下运行提供的 Node.js 命令,同时从 VS Code 进行附加,以调查启动时不稳定的崩溃。然后检查 node:inspector_network_tracking 和 src/inspector_agent.cc:1023,并将 ReadableWorkerStdio 初始化失败作为观察到的路径;启用网络跟踪后进程能够在没有 assertion 的情况下启动,即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
node.js
领域
devtools, networking
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
冷清
描述清晰度
基本清楚
新手友好度
48/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。