comzyh / clash

A rule-based tunnel in Go.
GNU General Public License v3.0
125 stars 33 forks source link

Panic on latest add-water branch #10

Closed ibigbug closed 3 years ago

ibigbug commented 3 years ago

it panics every few hours randomly with below traceback.

I'm running the build on latest add-water branch

any ideas how to debug/fix this?

thank you in advance.

Feb 11 00:59:49 clash clash[3778]: time="2021-02-11T00:59:49+08:00" level=warning msg="[TCP] dial 🅿️ Select (match DomainKeyword/apple.com.akadns.net) to gs-loc.ls-apple.com.akadns.net error: dial tcp4 17.142.171.8:443: i/o timeout"
Feb 11 02:37:57 clash clash[3778]: time="2021-02-11T02:37:57+08:00" level=warning msg="Can't create TCP Endpoint in ipstack: connection was refused"
Feb 11 02:40:42 clash clash[3778]: time="2021-02-11T02:40:42+08:00" level=warning msg="Can't create TCP Endpoint in ipstack: connection was refused"
Feb 11 02:40:42 clash clash[3778]: time="2021-02-11T02:40:42+08:00" level=warning msg="Can't create TCP Endpoint in ipstack: connection was refused"
Feb 11 03:58:27 clash clash[3778]: time="2021-02-11T03:58:27+08:00" level=warning msg="Can't create TCP Endpoint in ipstack: connection was refused"
Feb 11 06:09:14 clash clash[3778]: time="2021-02-11T06:09:14+08:00" level=warning msg="Can't create TCP Endpoint in ipstack: connection was refused"
Feb 11 06:10:43 clash clash[3778]: time="2021-02-11T06:10:43+08:00" level=warning msg="Can't create TCP Endpoint in ipstack: connection was refused"
Feb 11 08:07:19 clash clash[3778]: time="2021-02-11T08:07:19+08:00" level=warning msg="Can't create TCP Endpoint in ipstack: connection was refused"
Feb 11 08:40:46 clash clash[3778]: time="2021-02-11T08:40:46+08:00" level=warning msg="Can't create TCP Endpoint in ipstack: connection was refused"
Feb 11 08:55:55 clash clash[3778]: time="2021-02-11T08:55:55+08:00" level=warning msg="Can't create TCP Endpoint in ipstack: connection was refused"
Feb 11 09:34:59 clash clash[3778]: time="2021-02-11T09:34:59+08:00" level=warning msg="Can't create TCP Endpoint in ipstack: connection was refused"
Feb 11 10:27:05 clash clash[3778]: panic: runtime error: invalid memory address or nil pointer dereference
Feb 11 10:27:05 clash clash[3778]: [signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0x8ed9f1]
Feb 11 10:27:05 clash clash[3778]: goroutine 397009 [running]:
Feb 11 10:27:05 clash clash[3778]: github.com/Dreamacro/clash/adapters/inbound.NewSocket(0xc000b83760, 0x7, 0x7, 0xd1dbc0, 0xc00021b1a0, 0xa, 0xc000b83760)
Feb 11 10:27:05 clash clash[3778]:         /home/wtf/projects/clash/adapters/inbound/socket.go:16 +0x81
Feb 11 10:27:05 clash clash[3778]: github.com/Dreamacro/clash/proxy/tun.NewTunProxy.func1(0xc000376800)
Feb 11 10:27:05 clash clash[3778]:         /home/wtf/projects/clash/proxy/tun/tunproxy.go:89 +0x20b
Feb 11 10:27:05 clash clash[3778]: created by gvisor.dev/gvisor/pkg/tcpip/transport/tcp.(*Forwarder).HandlePacket
Feb 11 10:27:05 clash clash[3778]:         /home/wtf/go/pkg/mod/github.com/comzyh/gvisor@v0.0.0-20200922152710-c36c6379af83/pkg/tcpip/transport/tcp/forwarder.go:91 +0x2bd
Feb 11 10:27:05 clash systemd[1]: clash.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Feb 11 10:27:05 clash systemd[1]: clash.service: Failed with result 'exit-code'.
Feb 11 10:27:05 clash systemd[1]: clash.service: Service RestartSec=100ms expired, scheduling restart.
Feb 11 10:27:05 clash systemd[1]: clash.service: Scheduled restart job, restart counter is at 1.
Feb 11 10:27:05 clash systemd[1]: Stopped clash service.
Feb 11 10:27:05 clash systemd[1]: Started clash service.
comzyh commented 3 years ago

Thanks for reporting. I guess it's coming from https://github.com/google/gvisor/blob/6b785c5e3d79cb32ce49dec2aa97bec8e9725409/pkg/tcpip/adapters/gonet/gonet.go#L444 But I can't explain.

However, I just upgraded the gvisor version, you can have a try on https://github.com/comzyh/clash/tree/tun-dev

josh-chan commented 3 years ago

还是一样会挂

ibigbug commented 3 years ago

比较难复现,有时候会一天内连续出现,有时候隔几个月也没问题。

ibigbug commented 3 years ago

dup #8