SagerNet / sing-box

The universal proxy platform
https://sing-box.sagernet.org/
Other
18.82k stars 2.25k forks source link

多个链式代理会导致 sing-box 闪退 #1654

Closed Sentsuki closed 5 months ago

Sentsuki commented 5 months ago

操作系统

iOS

系统版本

17.4.1

安装类型

sing-box for iOS 图形客户端程序

如果您使用图形客户端程序,请提供该程序版本。

1.8.10

版本

No response

描述

使用 wireguard 协议和 vmess 协议进行链式代理,当配置多个类似协议组合后,iOS客户端无法启动,安卓图形客户端会表现为闪退。如果坚持反复启动,会有几率正常运行并正常代理,但关闭后再打开则会继续闪退。删减到只有一个组合时候运行正常。

在大运行内存的安卓设备上测试闪退情况减少,但 APP 启动速度明显下降。

重现方式

使用以下类似的配置配置多个链式代理节点。

     {
      "type": "wireguard",
      "tag": "wireguard-1",
      "server": "xxxxxxxx",
      "server_port": xxxxx,
      "local_address": [
        "xxxxxx",
        "xxxxxx"
        ],
      "private_key": "xxxxxxxx",
      "peer_public_key": "xxxxxxxxx",
      "reserved": [ xxxx ],
      "mtu": xxxx,
      "detour": "test-1"
    },

    {
      "tag": "test-1",
      "type": "vmess",
      "server": "xxxxxxxx",
      "server_port": xxxxxx,
      "uuid": "xxxxxxxxxxxxxxxxxxxxx",
      "security": "none",
      "alter_id": 0,
      "packet_encoding": "xudp"
    },

     {
      "type": "wireguard",
      "tag": "wireguard-2",
      "server": "xxxxxxxx",
      "server_port": xxxxx,
      "local_address": [
        "xxxxxx",
        "xxxxxx"
        ],
      "private_key": "xxxxxxxx",
      "peer_public_key": "xxxxxxxxx",
      "reserved": [ xxxx ],
      "mtu": xxxx,
      "detour": "test-2"
    },

    {
      "tag": "test-2",
      "type": "vmess",
      "server": "xxxxxxxx",
      "server_port": xxxxxx,
      "uuid": "xxxxxxxxxxxxxxxxxxxxx",
      "security": "none",
      "alter_id": 0,
      "packet_encoding": "xudp"
    },

     {
      "type": "wireguard",
      "tag": "wireguard-3",
      "server": "xxxxxxxx",
      "server_port": xxxxx,
      "local_address": [
        "xxxxxx",
        "xxxxxx"
        ],
      "private_key": "xxxxxxxx",
      "peer_public_key": "xxxxxxxxx",
      "reserved": [ xxxx ],
      "mtu": xxxx,
      "detour": "test-3"
    },

    {
      "tag": "test-3",
      "type": "vmess",
      "server": "xxxxxxxx",
      "server_port": xxxxxx,
      "uuid": "xxxxxxxxxxxxxxxxxxxxx",
      "security": "none",
      "alter_id": 0,
      "packet_encoding": "xudp"
    }

日志

Machine: iPhone11,8
System: iOS 17.4.1

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x20 pc=0x1033c89f8]

goroutine 60 [running]:
github.com/sagernet/sing-box/outbound.(*Selector).DialContext(0x1302dc680, {0x1039bea60, 0x1303a61e0}, {0x103557f74?, 0x0?}, {{{0x0, 0xffff01010101}, 0x1301ba090}, 0x1bb, {0x0, ...}})
    github.com/sagernet/sing-box/outbound/selector.go:130 +0x48
github.com/sagernet/sing-box/common/dialer.(*DetourDialer).DialContext(0x130018220?, {0x1039bea60, 0x1303a61e0}, {0x103557f74, 0x3}, {{{0x0, 0xffff01010101}, 0x1301ba090}, 0x1bb, {0x0, ...}})
    github.com/sagernet/sing-box/common/dialer/detour.go:47 +0x90
github.com/sagernet/sing-dns.CreateHTTPSTransport.NewHTTPSTransport.func1({0x1039bea60, 0x1303a61e0}, {0x103557f74, 0x3}, {0x130018220?, 0x130060f08?})
    github.com/sagernet/sing-dns@v0.1.14/transport_https.go:45 +0xb8
net/http.(*Transport).dial(0x0?, {0x1039bea60?, 0x1303a61e0?}, {0x103557f74?, 0x13048ca48?}, {0x130018220?, 0x13048ca68?})
    net/http/transport.go:1187 +0xdc
net/http.(*Transport).dialConn(0x1301f2140, {0x1039bea60, 0x1303a61e0}, {{}, 0x0, {0x130210540, 0x5}, {0x130018220, 0xb}, 0x0})
    net/http/transport.go:1648 +0x620
net/http.(*Transport).dialConnFor(0x1301f2140, 0x1302b00b0)
    net/http/transport.go:1485 +0x94
created by net/http.(*Transport).queueForDial in goroutine 59
    net/http/transport.go:1449 +0x380

支持我们

完整性要求

Sentsuki commented 5 months ago

Update: 已经解决

Sentsuki commented 5 months ago

Update: 并没有解决,安卓图形界面依然闪退,iOS端多次开关依然会有开启失败的情况,感觉还是内存和节点数量的原因

Sentsuki commented 5 months ago

Update: 今天在 Windows 上直接用裸核跑了一下,还是有闪退的问题,当删减节点到一定数量后正常启动。

Sentsuki commented 5 months ago

新版本似乎好了?我没有遇到过了,先关掉了