Closed maskedeken closed 3 years ago
有同样问题 ping @comzyh
同样问题,指定dns到本地smartdns稳定复现,换别的内核无此问题
最近更新了gvisor,我自己正在测。 https://github.com/comzyh/clash/tree/tun-dev 有兴趣可以试试
在mipsle平台上出现unaligned 64-bit atomic operation
goroutine 1 [running]: runtime/internal/atomic.panicUnaligned(...) F:/tools/go/src/runtime/internal/atomic/unaligned.go:8 runtime/internal/atomic.lockAndCheck(...) F:/tools/go/src/runtime/internal/atomic/atomic_mipsx.go:37 runtime/internal/atomic.Store64(0x1681ad4, 0x100000, 0x0) F:/tools/go/src/runtime/internal/atomic/atomic_mipsx.go:103 +0x94 gvisor.dev/gvisor/pkg/tcpip.(SocketOptions).SetSendBufferSize(0x1681a68, 0x100000, 0x0, 0x0) C:/Users/admin/go/pkg/mod/github.com/comzyh/gvisor@v0.0.0-20210301140817-31d323141418/pkg/tcpip/socketops.go:607 +0x19c gvisor.dev/gvisor/pkg/tcpip/transport/tcp.newEndpoint(0x14a7500, 0x800, 0x18d0260, 0x1440240) C:/Users/admin/go/pkg/mod/github.com/comzyh/gvisor@v0.0.0-20210301140817-31d323141418/pkg/tcpip/transport/tcp/endpoint.go:890 +0x200 gvisor.dev/gvisor/pkg/tcpip/transport/tcp.(protocol).NewEndpoint(0x183c1a0, 0x800, 0x18d0260, 0x14c2cf8, 0x96b601, 0x16bf201, 0x18d0260) C:/Users/admin/go/pkg/mod/github.com/comzyh/gvisor@v0.0.0-20210301140817-31d323141418/pkg/tcpip/transport/tcp/protocol.go:165 +0x50 gvisor.dev/gvisor/pkg/tcpip/stack.(Stack).NewEndpoint(0x14a7500, 0x6, 0x800, 0x18d0260, 0x0, 0x16bf290, 0xa53858, 0x8205d4) C:/Users/admin/go/pkg/mod/github.com/comzyh/gvisor@v0.0.0-20210301140817-31d323141418/pkg/tcpip/stack/stack.go:861 +0x90 gvisor.dev/gvisor/pkg/tcpip/adapters/gonet.ListenTCP(0x14a7500, 0x1, 0x0, 0x0, 0x35, 0x800, 0x0, 0x0, 0x0) C:/Users/admin/go/pkg/mod/github.com/comzyh/gvisor@v0.0.0-20210301140817-31d323141418/pkg/tcpip/adapters/gonet/gonet.go:70 +0x6c github.com/Dreamacro/clash/proxy/tun.CreateDNSServer(0x14a7500, 0x14c2410, 0x18a01f0, 0x1a0a2e0, 0x10, 0x10, 0x35, 0x1, 0x0, 0x0, ...) F:/projects/clash-tun/proxy/tun/tundns.go:175 +0x37c github.com/Dreamacro/clash/proxy/tun.(tunAdapter).ReCreateDNSServer(0x18a0310, 0x14c2410, 0x18a01f0, 0x14b5aa0, 0xa, 0x0, 0x0) F:/projects/clash-tun/proxy/tun/tundns.go:263 +0x1ac github.com/Dreamacro/clash/proxy.ReCreateTun(0x1, 0x14b5a80, 0xc, 0x14b5aa0, 0xa, 0x0, 0x0) F:/projects/clash-tun/proxy/listener.go:311 +0x2c0 github.com/Dreamacro/clash/hub/executor.updateGeneral(0x14a3c70, 0x1) F:/projects/clash-tun/hub/executor/executor.go:212 +0x1dc github.com/Dreamacro/clash/hub/executor.ApplyConfig(0x1679400, 0xa52c01) F:/projects/clash-tun/hub/executor/executor.go:74 +0xec github.com/Dreamacro/clash/hub.Parse(0x0, 0x0, 0x0, 0x6, 0xfb67a0) F:/projects/clash-tun/hub/hub.go:48 +0x110 main.main() F:/projects/clash-tun/main.go:98 +0x3f8
seems 32bit processor can't access a 64bit value atomically if its address is not aligned at a multiple of 8.
比较难复现,有时候会一天内连续出现,有时候隔几个月也没问题。
看起来你们是在用 tun 的 DNS 是吗?
tun:
enable: true
stack: system
device-url: dev://clash0
dns-hijack:
- 10.0.0.5
dns:
enable: true
listen: 0.0.0.0:53
enhanced-mode: redir-host
nameserver:
是的,10.0.0.5 是 PiHole
在mipsle平台上出现unaligned 64-bit atomic operation
goroutine 1 [running]: runtime/internal/atomic.panicUnaligned(...) F:/tools/go/src/runtime/internal/atomic/unaligned.go:8 runtime/internal/atomic.lockAndCheck(...) F:/tools/go/src/runtime/internal/atomic/atomic_mipsx.go:37 runtime/internal/atomic.Store64(0x1681ad4, 0x100000, 0x0) F:/tools/go/src/runtime/internal/atomic/atomic_mipsx.go:103 +0x94 gvisor.dev/gvisor/pkg/tcpip.(SocketOptions).SetSendBufferSize(0x1681a68, 0x100000, 0x0, 0x0) C:/Users/admin/go/pkg/mod/github.com/comzyh/gvisor@v0.0.0-20210301140817-31d323141418/pkg/tcpip/socketops.go:607 +0x19c gvisor.dev/gvisor/pkg/tcpip/transport/tcp.newEndpoint(0x14a7500, 0x800, 0x18d0260, 0x1440240) C:/Users/admin/go/pkg/mod/github.com/comzyh/gvisor@v0.0.0-20210301140817-31d323141418/pkg/tcpip/transport/tcp/endpoint.go:890 +0x200 gvisor.dev/gvisor/pkg/tcpip/transport/tcp.(protocol).NewEndpoint(0x183c1a0, 0x800, 0x18d0260, 0x14c2cf8, 0x96b601, 0x16bf201, 0x18d0260) C:/Users/admin/go/pkg/mod/github.com/comzyh/gvisor@v0.0.0-20210301140817-31d323141418/pkg/tcpip/transport/tcp/protocol.go:165 +0x50 gvisor.dev/gvisor/pkg/tcpip/stack.(Stack).NewEndpoint(0x14a7500, 0x6, 0x800, 0x18d0260, 0x0, 0x16bf290, 0xa53858, 0x8205d4) C:/Users/admin/go/pkg/mod/github.com/comzyh/gvisor@v0.0.0-20210301140817-31d323141418/pkg/tcpip/stack/stack.go:861 +0x90 gvisor.dev/gvisor/pkg/tcpip/adapters/gonet.ListenTCP(0x14a7500, 0x1, 0x0, 0x0, 0x35, 0x800, 0x0, 0x0, 0x0) C:/Users/admin/go/pkg/mod/github.com/comzyh/gvisor@v0.0.0-20210301140817-31d323141418/pkg/tcpip/adapters/gonet/gonet.go:70 +0x6c github.com/Dreamacro/clash/proxy/tun.CreateDNSServer(0x14a7500, 0x14c2410, 0x18a01f0, 0x1a0a2e0, 0x10, 0x10, 0x35, 0x1, 0x0, 0x0, ...) F:/projects/clash-tun/proxy/tun/tundns.go:175 +0x37c github.com/Dreamacro/clash/proxy/tun.(tunAdapter).ReCreateDNSServer(0x18a0310, 0x14c2410, 0x18a01f0, 0x14b5aa0, 0xa, 0x0, 0x0) F:/projects/clash-tun/proxy/tun/tundns.go:263 +0x1ac github.com/Dreamacro/clash/proxy.ReCreateTun(0x1, 0x14b5a80, 0xc, 0x14b5aa0, 0xa, 0x0, 0x0) F:/projects/clash-tun/proxy/listener.go:311 +0x2c0 github.com/Dreamacro/clash/hub/executor.updateGeneral(0x14a3c70, 0x1) F:/projects/clash-tun/hub/executor/executor.go:212 +0x1dc github.com/Dreamacro/clash/hub/executor.ApplyConfig(0x1679400, 0xa52c01) F:/projects/clash-tun/hub/executor/executor.go:74 +0xec github.com/Dreamacro/clash/hub.Parse(0x0, 0x0, 0x0, 0x6, 0xfb67a0) F:/projects/clash-tun/hub/hub.go:48 +0x110 main.main() F:/projects/clash-tun/main.go:98 +0x3f8
https://github.com/google/gvisor/issues/5692 我想等他们修了这个直接用
定位在这行,conn.RemoteAddr()
可能返回空
https://github.com/comzyh/clash/blob/c01080b144e6afbf6971f48fac8b91cd6cec3e44/adapters/inbound/socket.go#L16
原因是
https://github.com/google/gvisor/blob/6b785c5e3d79cb32ce49dec2aa97bec8e9725409/pkg/tcpip/adapters/gonet/gonet.go#L444
// RemoteAddr implements net.Conn.RemoteAddr.
func (c *TCPConn) RemoteAddr() net.Addr {
a, err := c.ep.GetRemoteAddress()
if err != nil {
return nil
}
return fullToTCPAddr(a)
}
这里c.ep.GetRemoteAddress()
可能返回异常,原因是tcp的GetRemoteAddress
在非Connected 的状态下会返回异常。
// GetRemoteAddress returns the address to which the endpoint is connected.
func (e *endpoint) GetRemoteAddress() (tcpip.FullAddress, tcpip.Error) {
e.LockUser()
defer e.UnlockUser()
if !e.EndpointState().connected() {
return tcpip.FullAddress{}, &tcpip.ErrNotConnected{}
}
return e.getRemoteAddress(), nil
}
9c7e536e5d0aeb2680f6630acf6b442727fedd55 应该能修复这个问题
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 5 days
panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x14 pc=0x4c4f14]
goroutine 80464 [running]: github.com/Dreamacro/clash/adapters/inbound.NewSocket(0x2c21890, 0x7, 0x7, 0x830718, 0x29c9440, 0x9, 0x2c21890) F:/projects/myclash3/adapters/inbound/socket.go:26 +0x60 github.com/Dreamacro/clash/proxy/tun.NewTunProxy.func1(0x3516510) F:/projects/myclash3/proxy/tun/tunproxy.go:94 +0x190 created by gvisor.dev/gvisor/pkg/tcpip/transport/tcp.(*Forwarder).HandlePacket C:/Users/admin/go/pkg/mod/github.com/comzyh/gvisor@v0.0.0-20200814151311-224de3a00460/pkg/tcpip/transport/tcp/forwarder.go:91 +0x200