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

[BUG]: Inbounds will not listen when JSONv5 config file is larger than 2kB.

Open universonic opened this issue 2 years ago • 1 comments

What version of V2Ray are you using?

v5.1.0

What's your scenario of using V2Ray?

Running as server

What problems have you encountered?

When I use vlite as one of inbound, all inbounds are not working. V2ray will not listen on any configured inbound. You can reproduce the problem with the following server configuration and verify the listening ports with command: netstat -antupl | grep LISTEN

What's your expectation?

Every inbound listen on their port.

Please attach your configuration here

Server configuration:

{
    "log": {
        "loglevel": "warning"
    },
    "inbounds": [{
        "port": 443,
        "listen": "0.0.0.0",
        "protocol": "vless",
        "settings": {
            "clients": [
                {
                    "id": "d9e5c982-6efb-4e39-9011-bbbe7f2bd73a",
                    "level": 0
                }
            ],
            "decryption": "none",
            "fallbacks": [
                {
                    "dest": 80,
                    "xver": 1
                }
            ]
        },
        "streamSettings": {
            "network": "tcp",
            "security": "tls",
            "tlsSettings": {
                "alpn": [
                    "http/1.1"
                ],
                "certificates": [
                    {
                        "certificateFile": "/etc/ssl/private/server.crt",
                        "keyFile": "/etc/ssl/private/server.key"
                    }
                ]
            },
            "sockopt": {
                "tcpFastOpen": true
            }
        },
        "tag": "vless"
    }, {
        "port": 843,
        "listen": "0.0.0.0",
        "protocol": "vliteu",
        "settings": {
            "password": "xxxxxxxxxxx",
            "enableFec": true,
            "enableStabilization": true,
            "enableRenegotiation": true
        },
        "tag": "vlite"
    }],
    "outbounds": [{
        "protocol": "freedom",
        "settings": {}
    }, {
        "protocol": "blackhole",
        "settings": {},
        "tag": "blocked"
    }],
    "routing": {
        "strategy": "rules",
        "settings": {
            "rules": [
                {
                    "type": "field",
                    "ip": [
                        "0.0.0.0/8",
                        "10.0.0.0/8",
                        "100.64.0.0/10",
                        "127.0.0.0/8",
                        "169.254.0.0/16",
                        "172.16.0.0/12",
                        "192.0.0.0/24",
                        "192.0.2.0/24",
                        "192.168.0.0/16",
                        "198.18.0.0/15",
                        "198.51.100.0/24",
                        "203.0.113.0/24",
                        "::1/128",
                        "fc00::/7",
                        "fe80::/10"
                    ],
                    "outboundTag": "blocked"
                }
            ]
        }
    }
}

Client configuration:

(not needed)

Please attach error logs here

Server error log:

Nothing at all. See journal log below.

Client error log:

(not needed)

Please attach access log here

(not needed)

Other configurations (such as Nginx) and logs here

If V2Ray cannot start up, please attach output from --test command

If V2Ray service is abnormal, please attach journal log here

systemd[1]: Started V2Ray Service.
v2ray[83803]: V2Ray 5.1.0 (V2Fly, a community-driven edition of V2Ray.) Custom (go1.19 linux/amd64)
v2ray[83803]: A unified platform for anti-censorship.
v2ray[83803]: 2022/09/07 04:36:34 [Warning] V2Ray 5.1.0 started

Besides, the OS is Rocky Linux 8, both SELinux and firewalld are disabled. I modified file /etc/systemd/system/v2ray.service.d/10-donot_touch_single_conf.conf a bit to make v2ray support the jsonv5 config format.

Content of file /etc/systemd/system/v2ray.service.d/10-donot_touch_single_conf.conf:

# In case you have a good reason to do so, duplicate this file in the same directory and make your customizes there.
# Or all changes you made will be lost!  # Refer: https://www.freedesktop.org/software/systemd/man/systemd.unit.html
[Service]
ExecStart=
ExecStart=/usr/local/bin/v2ray run -config /usr/local/etc/v2ray/config.json -format jsonv5

universonic avatar Sep 07 '22 05:09 universonic

Seems like the problem is caused by a 2048 byte read limit on the JSONv5 configuration file. A fix #1923 has been merged into upstream. Now waiting for a new version to be released.

universonic avatar Sep 16 '22 14:09 universonic

This issue is stale because it has been open 120 days with no activity. Remove stale label or comment or this will be closed in 5 days

github-actions[bot] avatar Jan 15 '23 02:01 github-actions[bot]