wyx2685/V2bX

Sing-Box 在引入 URLTest 后,启动时崩溃

Closed this issue · 4 comments

描述该错误
在 sing_origin..json 中添加 URLTest 后,sing-box 重启时会崩溃。

复现

  1. 在 sing_origin..json 的 outbounds 中添加类似如下的内容:
    {
      "type": "urltest",
      "tag": "TW_HiNet_auto",
      "outbounds": [
        "Akile-TW_s5_out",
        "WAP-TW_s5_out",
        "Viie-TW_vmess_out"
      ],
      "url": "http://cp.cloudflare.com/",
      "interval": "5m",
      "tolerance": 50
    }

image

  1. v2bx restart
  2. 观察到 Sing-Box 崩溃

环境和版本

  • 系统 Debian 11
  • 架构 AMD64
  • 面板 Xboard
  • 协议 N/A
  • 版本 v0.0.9
  • 部署方式 一键脚本

日志和错误

Jul 14 05:34:42 yxvm-3243850 V2bX[8933]: panic: runtime error: invalid memory address or nil pointer dereference
Jul 14 05:34:42 yxvm-3243850 V2bX[8933]: [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xc96786]
Jul 14 05:34:42 yxvm-3243850 V2bX[8933]: goroutine 24 [running]:
Jul 14 05:34:42 yxvm-3243850 V2bX[8933]: github.com/sagernet/sing-box/common/urltest.(*HistoryStorage).StoreURLTestHistory(0x0, {0xc001350b50, 0xf}, 0xc001730d60)
Jul 14 05:34:42 yxvm-3243850 V2bX[8933]:         github.com/sagernet/sing-box@v1.10.0/common/urltest/urltest.go:54 +0x26
Jul 14 05:34:42 yxvm-3243850 V2bX[8933]: github.com/sagernet/sing-box/outbound.(*URLTestGroup).urlTest.func1()
Jul 14 05:34:42 yxvm-3243850 V2bX[8933]:         github.com/sagernet/sing-box@v1.10.0/outbound/urltest.go:396 +0x3af
Jul 14 05:34:42 yxvm-3243850 V2bX[8933]: github.com/sagernet/sing/common/batch.(*Batch[...]).Go.func1()
Jul 14 05:34:42 yxvm-3243850 V2bX[8933]:         github.com/sagernet/sing@v0.5.0-alpha.12/common/batch/batch.go:59 +0x11e
Jul 14 05:34:42 yxvm-3243850 V2bX[8933]: created by github.com/sagernet/sing/common/batch.(*Batch[...]).Go in goroutine 17
Jul 14 05:34:42 yxvm-3243850 V2bX[8933]:         github.com/sagernet/sing@v0.5.0-alpha.12/common/batch/batch.go:50 +0xb9
Jul 14 05:34:42 yxvm-3243850 systemd[1]: V2bX.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Jul 14 05:34:42 yxvm-3243850 systemd[1]: V2bX.service: Failed with result 'exit-code'.
Jul 14 05:34:52 yxvm-3243850 systemd[1]: V2bX.service: Scheduled restart job, restart counter is at 113.

额外的内容
此功能的必要性:为保证服务的稳定性,需要接入多个落地(比如我这里的场景,多个 HiNet)。URLTest 能自动在不同落地间切换,并选择体验最好的那一个。
观察到 URLTest 块位置不同时(在 outbound 的最前面、中间、最后面),报错会有些许差异。猜测可能跟节点的启动顺序有关。此处有可能相关的 issue

@PA733 感谢反馈 有空我查一下

等Action编译完麻烦测试b965456

等Action编译完麻烦测试b965456

收到,稍后反馈测试结果

已确认修复,感谢佬!