【问题标题】:Electron "Network service crashed, restarting service."Electron“网络服务崩溃,正在重新启动服务。”
【发布时间】:2021-12-17 03:44:42
【问题描述】:

偶尔,当我在 Docker 容器中运行 Electron 时,会收到以下错误:

[15:1102/154337.143944:ERROR:network_service_instance_impl.cc(333)] Network service crashed, restarting service.

这会导致在 localhost 上加载了 win.loadURL 的前端应用程序部分呈现

该问题似乎与https://bbs.archlinux.org/viewtopic.php?id=268123 非常相似,但建议中没有任何效果。

运行最新的 Electron 15.0.2 和 Chromedriver 95.0.0

另外,当关闭 Electron 窗口时,我得到一个错误

Error: ERR_FAILED (-2) loading 'https://localhost:{port}/{path_to}/index.html'
    at rejectAndCleanup (node:electron/js2c/browser_init:165:7486)
    at Object.stopLoadingListener (node:electron/js2c/browser_init:165:7861)
    at Object.emit (node:events:394:28) {
  errno: -2,
  code: 'ERR_FAILED',
  url: 'https://localhost:{port}/{path_to}/index.html'
} [EOL]

在执行 await win.loadURL(url) 时会在 main.js 中捕获

另外,在 Electron 浏览器窗口的控制台日志中,会出现这个错误:

ERROR Error: Uncaught (in promise): ChunkLoadError: Loading chunk 108 failed.
(timeout: https://localhost:{port}/{path_to}/108.da4993913b4a27951976.js)
ChunkLoadError: Loading chunk 108 failed.

以前有人遇到过这个问题吗?

【问题讨论】:

    标签: node.js linux electron chromium


    【解决方案1】:

    我设法找到了引发问题的原因,而不是根本原因。

    我注释掉了setCertificateVerifyProc Electron 钩子,问题似乎不再出现了。

    // win.webContents.session.setCertificateVerifyProc((request, callback) => {
    //   callback(-3);  
    // });
    

    在Electron docs 中有一条有趣的说明:

    NOTE: The result of this procedure is cached by the network service.
    

    这实际上反映在日志上

    network_service_instance_impl.cc(333)] Network service crashed
    

    如果您需要有关此问题的更多信息,请关注 Electron Github 官方问题页面https://github.com/electron/electron/issues/31675

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-05-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多