XTLS / Xray-core

Xray, Penetrates Everything. Also the best v2ray-core, with XTLS support. Fully compatible configuration.
https://t.me/projectXray
Mozilla Public License 2.0
25.45k stars 3.93k forks source link

Ubuntu 20.4,xray进程意外退。 #403

Closed ruderal04o closed 3 years ago

ruderal04o commented 3 years ago

系统:ubuntu20.4,两个IP地址,x.x.x.x负责xray传入。y.y.y.y负责传出。1G RAM,1CPU。 config大致如下:

{ "log": { "loglevel": "error", "access": "none", "error": "/var/log/xray/error.log" }, "dns": { "servers": [ "127.0.0.53" ] }, "inbounds": [ { "sniffing": { "enabled": true, "destOverride": [ "http", "tls" ] }, "tag": "vmess-in", "listen": "/dev/shm/xz.socket", "protocol": "vmess", "settings": { "clients": [ clientsxy ], "disableInsecureEncryption": false }, "streamSettings": { "network": "ws", "security": "none", "wsSettings": { "path": "/xxxyz" } } }, { "sniffing": { "enabled": true, "destOverride": [ "http", "tls" ] }, "listen": "/dev/shm/xz1.socket", "tag": "vless-in", "protocol": "vless", "settings": { "clients": [ clientsxz ], "decryption": "none" }, "streamSettings": { "network": "ws", "security": "none", "wsSettings": { "path": "/xxxyz2" } } } ], "outbounds": [ { "sendThrough": "y.y.y.y", "tag": "direct", "protocol": "freedom", "settings": { "domainStrategy": "UseIPv4", "timeout": 300 } }, { "tag": "blocked", "protocol": "blackhole", "settings": { "response": { "type": "none" } } }, { "tag": "dns-out", "protocol": "dns", "settings": { "network": "udp", "address": "127.0.0.53", "port": 53 } } ], "routing": { "domainStrategy": "AsIs", "rules": [ { "type": "field", "port": "53", "outboundTag": "dns-out" }, { "type": "field", "domain": [ "geosite:category-ads-all" ], "outboundTag": "blocked" }, { "type": "field", "ip": [ "geoip:private" ], "outboundTag": "blocked" }, { "type": "field", "network": "tcp,udp", "outboundTag": "direct" } ] } }

syslog有如下日志。 Mar 19 02:20:22 myservice xray[700]: panic: runtime error: slice bounds out of range [:8192] with capacity 0 Mar 19 02:20:22 myservice xray[700]: goroutine 648527 [running]: Mar 19 02:20:22 myservice xray[700]: github.com/xtls/xray-core/common/buf.(Buffer).Bytes(...) Mar 19 02:20:22 myservice xray[700]: #011github.com/xtls/xray-core/common/buf/buffer.go:90 Mar 19 02:20:22 myservice xray[700]: github.com/xtls/xray-core/proxy/freedom.(PacketReader).ReadMultiBuffer(0xc000af4150, 0xc00248ccb8, 0x1, 0x1, 0x0, 0x0) Mar 19 02:20:22 myservice xray[700]: #011github.com/xtls/xray-core/proxy/freedom/freedom.go:222 +0x3b1 Mar 19 02:20:22 myservice xray[700]: github.com/xtls/xray-core/common/buf.copyInternal(0x102ec60, 0xc000af4150, 0x102fa60, 0xc000c96228, 0xc000af4180, 0xc00022de01, 0xc000af4168) Mar 19 02:20:22 myservice xray[700]: #011github.com/xtls/xray-core/common/buf/copy.go:81 +0x49 Mar 19 02:20:22 myservice xray[700]: github.com/xtls/xray-core/common/buf.Copy(0x102ec60, 0xc000af4150, 0x102fa60, 0xc000c96228, 0xc00022df10, 0x1, 0x1, 0xc000db9c00, 0x102e420) Mar 19 02:20:22 myservice xray[700]: #011github.com/xtls/xray-core/common/buf/copy.go:104 +0xa8 Mar 19 02:20:22 myservice xray[700]: github.com/xtls/xray-core/proxy/freedom.(*Handler).Process.func3(0x0, 0x0) Mar 19 02:20:22 myservice xray[700]: #011github.com/xtls/xray-core/proxy/freedom/freedom.go:181 +0x16f Mar 19 02:20:22 myservice xray[700]: github.com/xtls/xray-core/common/task.OnSuccess.func1(0x7ffa348f8120, 0xc000ae28c0) Mar 19 02:20:22 myservice xray[700]: #011github.com/xtls/xray-core/common/task/task.go:12 +0x2f Mar 19 02:20:22 myservice xray[700]: github.com/xtls/xray-core/common/task.Run.func1(0xc000c96248, 0xc00122ba40, 0xc000af4138) Mar 19 02:20:22 myservice xray[700]: #011github.com/xtls/xray-core/common/task/task.go:28 +0x2b Mar 19 02:20:22 myservice xray[700]: created by github.com/xtls/xray-core/common/task.Run Mar 19 02:20:22 myservice xray[700]: #011github.com/xtls/xray-core/common/task/task.go:27 +0x152 Mar 19 02:20:22 myservice systemd[1]: xray.service: Main process exited, code=exited, status=2/INVALIDARGUMENT Mar 19 02:20:22 myservice systemd[1]: xray.service: Failed with result 'exit-code'. Mar 19 02:20:22 myservice systemd[1]: xray.service: Scheduled restart job, restart counter is at 1. Mar 19 02:20:22 myservice systemd[1]: Stopped Xray Service. Mar 19 02:20:22 myservice systemd[1]: Started Xray Service. Mar 19 02:20:22 myservice xray[3364]: Xray 1.4.0 (Xray, Penetrates Everything.) Custom (go1.16.2 linux/amd64) Mar 19 02:20:22 myservice xray[3364]: A unified platform for anti-censorship. Mar 19 02:20:22 myservice xray[3364]: 2021/03/19 02:20:22 [Info] infra/conf/serial: Reading config: /usr/local/etc/xray/config.json Mar 19 02:20:22 myservice xray[3364]: Failed to start: app/proxyman/inbound: failed to listen Unix Domain Socket on /dev/shm/vmess.socket > transport/internet: failed to listen on unix address: /dev/shm/vmess.socket > transport/internet/websocket: failed to listen unix domain socket(for WS) on /dev/shm/vmess.socket > listen unix /dev/shm/vmess.socket: bind: address already in use Mar 19 02:20:22 myservice systemd[1]: xray.service: Main process exited, code=exited, status=255/EXCEPTION Mar 19 02:20:22 myservice systemd[1]: xray.service: Failed with result 'exit-code'. Mar 19 02:20:23 myservice systemd[1]: xray.service: Scheduled restart job, restart counter is at 2. Mar 19 02:20:23 myservice systemd[1]: Stopped Xray Service.

请高人指点以下。

ghost commented 3 years ago

有些奇怪,可以尝试避免一下这个问题。

RPRX commented 3 years ago

看了下相关的代码,应该不会出现这个 panic,你可能遇到了宇宙射线导致的比特反转,若再次遇到,请开新的 issue

ruderal04o commented 3 years ago

sniffing分流出现中转请求异常

看了下相关的代码,应该不会出现这个 panic,你可能遇到了宇宙射线导致的比特反转,若再次遇到,请开新的 issue

我尝试使用了这个“sniffing分流出现中转请求异常”这个bug下的修复程序之后好像没遇到过了。我继续观察一下。谢谢。你们辛苦了