v2ray-core icon indicating copy to clipboard operation
v2ray-core copied to clipboard

Crash report: panic: runtime error: slice bounds out of range

Open Ali-Razmjoo opened this issue 2 years ago • 0 comments

Hi,

My v2ray servers are crashing from time to time with an error. Here are some information.

Information

  • V2Ray Version: v5.12.1
  • Env var in affect: v2ray.ray.buffer.size=0
* Host OS: root@nuremberg-2 ~/v2ray # uname -a
Linux nuremberg-2 5.15.0-86-generic #96-Ubuntu SMP Wed Sep 20 08:29:36 UTC 2023 aarch64 aarch64 aarch64 GNU/Linux
root@nuremberg-2 ~/v2ray # cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=22.04
DISTRIB_CODENAME=jammy
DISTRIB_DESCRIPTION="Ubuntu 22.04.3 LTS"
root@nuremberg-2 ~/v2ray # docker -v
Docker version 24.0.7, build afdd53b
root@nuremberg-2 ~/v2ray # docker-compose -v
docker-compose version 1.29.2, build unknown
root@nuremberg-2 ~/v2ray # docker compose version
Docker Compose version v2.21.0
FROM ubuntu:24.04
WORKDIR /app
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update
RUN apt-get upgrade -y
RUN apt-get install -y curl axel wget jq git nano unzip --fix-missing
COPY . .
RUN chmod +x /app/*.sh
RUN ./install_v2ray.sh
CMD ./entrypoint.sh

Server, here is the server configuration sample.


{
    "api": {
        "services": [
            "HandlerService",
            "StatsService"
        ],
        "tag": "api"
    },
    "dns": null,
    "fakeDns": null,
    "inbounds": [
        {
            "listen": "127.0.0.1",
            "port": 62789,
            "protocol": "dokodemo-door",
            "settings": {
                "address": "127.0.0.1"
            },
            "sniffing": {
                "destOverride": [
                    "http",
                    "tls"
                ],
                "enabled": false
            },
            "streamSettings": null,
            "tag": "api"
        },
        {
            "listen": null,
            "port": 443,
            "protocol": "vless",
            "settings": {
                "clients": [
                    {
                        "alterId": 0,
                        "email": "[email protected]",
                        "id": "xxxxxxxxxxx",
                        "level": 0
                    }
                ],
                "decryption": "none"
            },
            "sniffing": {
                "destOverride": [
                    "http",
                    "tls"
                ],
                "enabled": false
            },
            "streamSettings": {
                "grpcSettings": {
                    "serviceName": "GunService"
                },
                "network": "gun",
                "security": "tls",
                "tlsSettings": {
                    "allowInsecure": true,
                    "alpn": [
                        "h2"
                    ],
                    "certificates": [
                        {
                            "certificateFile": "/secrets/fullchain.pem",
                            "keyFile": "/secrets/privkey.pem"
                        }
                    ],
                    "serverName": "xxxxxxxxxxxxxxxxx.com"
                }
            }
        },
        {
            "listen": null,
            "port": 80,
            "protocol": "vmess",
            "settings": {
                "clients": [
                    {
                        "alterId": 0,
                        "email": "[email protected]",
                        "id": "xxxxxxxxx",
                        "level": 0
                    }
                ],
                "default": {
                    "alterId": 0,
                    "level": 0
                },
                "disableInsecureEncryption": false
            },
            "sniffing": {
                "destOverride": [
                    "http",
                    "tls"
                ],
                "enabled": false
            },
            "streamSettings": {
                "mux": {
                    "concurrency": 8,
                    "enabled": true
                },
                "network": "ws",
                "security": "none",
                "wsSettings": {
                    "acceptProxyProtocol": false,
                    "headers": {
                        "Connection": "keep-alive",
                        "Content-Type": "application/x-shockwave-flash, application/octet-stream, text/html,  application/x-shockwave-flash",
                        "Pragma": "no-cache",
                        "Transfer-Encoding": "chunked"
                    },
                    "path": "/somepath"
                }
            },
            "tag": "inbound-80"
        }
    ],
    "log": {
        "enabled": false
    },
    "outbounds": [
        {
            "protocol": "freedom",
            "settings": {},
            "tag": "direct"
        },
        {
            "protocol": "blackhole",
            "settings": {},
            "tag": "blocked"
        }
    ],
    "policy": {
        "levels": {
            "0": {
                "statsUserDownlink": true,
                "statsUserUplink": true
            }
        },
        "system": {
            "statsInboundDownlink": true,
            "statsInboundUplink": true
        }
    },
    "reverse": null,
    "routing": {
        "rules": [
            {
                "inboundTag": [
                    "api"
                ],
                "outboundTag": "api",
                "type": "field"
            },
            {
                "ip": [
                    "geoip:private"
                ],
                "outboundTag": "blocked",
                "type": "field"
            },
            {
                "outboundTag": "blocked",
                "protocol": [
                    "bittorrent"
                ],
                "type": "field"
            }
        ]
    },
    "stats": {
        "port": 62789
    },
    "transport": null
}

Crash details

v2ray    | panic: runtime error: slice bounds out of range [28:0]
v2ray    |
v2ray    | goroutine 126567 [running]:
v2ray    | github.com/v2fly/v2ray-core/v5/common/buf.(*Buffer).Read(...)
v2ray    |      github.com/v2fly/v2ray-core/v5/common/buf/buffer.go:243
v2ray    | github.com/v2fly/v2ray-core/v5/common/buf.SplitBytes({0x400250bae8, 0x1, 0x1}, {0x4000c34000?, 0xfffe5510a158?, 0x4001c67b90?})
v2ray    |      github.com/v2fly/v2ray-core/v5/common/buf/multi_buffer.go:105 +0x244
v2ray    | github.com/v2fly/v2ray-core/v5/common/buf.(*BufferedReader).Read(0x4001c67bf0, {0x4000c34000?, 0x28?, 0xeaa440?})
v2ray    |      github.com/v2fly/v2ray-core/v5/common/buf/reader.go:68 +0x94
v2ray    | io.ReadAtLeast({0x11be0e0, 0x4001c67bf0}, {0x4000c34000, 0x4e4, 0x800}, 0x4e4)
v2ray    |      io/io.go:335 +0xa0
v2ray    | io.ReadFull(...)
v2ray    |      io/io.go:354
v2ray    | github.com/v2fly/v2ray-core/v5/common/buf.(*Buffer).ReadFullFrom(0x4001c86c30, {0x11be0e0?, 0x4001c67bf0?}, 0x2?)
v2ray    |      github.com/v2fly/v2ray-core/v5/common/buf/buffer.go:266 +0x7c
v2ray    | github.com/v2fly/v2ray-core/v5/proxy/vless/encoding.(*LengthPacketReader).ReadMultiBuffer(0x4001c86c00)
v2ray    |      github.com/v2fly/v2ray-core/v5/proxy/vless/encoding/addons.go:155 +0x260
v2ray    | github.com/v2fly/v2ray-core/v5/common/buf.copyInternal({0x11be660, 0x4001c86c00}, {0x11bce20, 0x4001e5ffa0}, 0x40018ed7b8)
v2ray    |      github.com/v2fly/v2ray-core/v5/common/buf/copy.go:81 +0x48
v2ray    | github.com/v2fly/v2ray-core/v5/common/buf.Copy({0x11be660, 0x4001c86c00}, {0x11bce20, 0x4001e5ffa0}, {0x4000afaee8, 0x1, 0x4000afaeb8?})
v2ray    |      github.com/v2fly/v2ray-core/v5/common/buf/copy.go:104 +0x90
v2ray    | github.com/v2fly/v2ray-core/v5/proxy/vless/inbound.(*Handler).Process.func4()
v2ray    |      github.com/v2fly/v2ray-core/v5/proxy/vless/inbound/inbound.go:404 +0x190
v2ray    | github.com/v2fly/v2ray-core/v5/proxy/vless/inbound.(*Handler).Process.OnSuccess.func12()
v2ray    |      github.com/v2fly/v2ray-core/v5/common/task/task.go:12 +0x30
v2ray    | github.com/v2fly/v2ray-core/v5/common/task.Run.func1(0x4000c39050?)
v2ray    |      github.com/v2fly/v2ray-core/v5/common/task/task.go:28 +0x34
v2ray    | created by github.com/v2fly/v2ray-core/v5/common/task.Run in goroutine 126565
v2ray    |      github.com/v2fly/v2ray-core/v5/common/task/task.go:27 +0xd4

Ali-Razmjoo avatar Dec 24 '23 22:12 Ali-Razmjoo