v2ray / v2ray-core

A platform for building proxies to bypass network restrictions.
https://www.v2ray.com/
MIT License
45.37k stars 8.94k forks source link

mux 导致非正常内存占用率 #654

Closed vvtommy closed 6 years ago

vvtommy commented 6 years ago

1) v2.43 2) client 与 server 之间通过 websocket 通信,编码方式为 vmess。中间为 websocket 加了一层 tls 反代。client 带宽上下对等 50M,server 带宽上下对等 25M。client 到 server 可以跑满25M带宽,低延迟(≤20ms)。server 与 client 操作系统均为 Ubuntu 14.04,机器配置均为双核CPU,内存4G。 3) client 在打开 mux 时({"enabled":true}),进程v2ray吃掉机器所有剩余内存:当 {"concurrency":2} 时,表现为 CPU 跑满(≥180%),内存 ≥50%; concurrency ≥ 4 时,表现为 CPU ≈ 20%±10%,而内存吃掉机器剩余所有内存(≥ 90%)。 4) 关掉 concurrency 后,正常负载在 CPU ≈ 20%±10%,内存占用在 300MB 左右。

5) Server Configuration File(服务器端配置文件):

{
    "log": {
        "access": "/var/log/video_p/access.log",
        "error": "/var/log/video_p/error.log",
        "loglevel": "warning"
    },
    "inbound": {
        "port": *****,
        "protocol": "vmess",
        "settings": {
            "clients": [{
                "id": "******",
                "alterId": ***,
                "level": 1,
                "email": "******"
            }]
        },
        "streamSettings": {
            "network": "ws"
        }
    },
    "outbound": {
        "protocol": "freedom",
        "settings": {}
    },
    "outboundDetour": [{
        "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 File(客户端配置文件):
{
    "log": {
        "access": "/var/log/v2ray/access.log",
        "error": "/var/log/v2ray/error.log",
        "loglevel": "warning"
    },
    "inbound": {
        "port": *****, 
        "protocol": "shadowsocks",
        "settings": {
            "method": "*****",
            "udp": true,
            "email": "*****",
            "ota": true, 
            "password": "*****"
        }
    },
    "outbound": {
        "protocol": "vmess",
        "settings": {
            "vnext": [{
                "address": "*****",
                "port": *****,
                "users": [{
                    "id": "*****",
                    "alterId": *****
                }]
            }]
        },
        "mux": {
            "enabled": true,
            "concurrency": 2
        },
        "streamSettings": {
            "network": "ws",
            "security": "tls",
            "tlsSettings": {
                "serverName": "*****",
                "allowInsecure": true
            }
        }
    },
    "transport": {
        "wsSettings": {
            "connectionReuse": true,
            "path": "/",
            "headers": {
                "Host": "*****",
                "User-Agent": "*****",
                …
                …
            }
        }
    },
    "outboundDetour": [{
        "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"
            }]
        }
    }
}

6) 错误日志 Server Log File(服务器端日志):

 // 无错误

Client Log File(客户端日志):

2017/10/26 20:14:18 [Warning]failed to handler mux client connection > Proxy|VMess|Outbound: connection ends > context canceled
…
…
大量同样的
…
…
Ahlaman commented 6 years ago

server:Ubuntu 16.04

我遇到了和你一样的warning 另外还有 [Warning]failed to handler mux client connection > Proxy|VMess|Outbound: connection ends > websocket: close 1006 (abnormal closure): unexpected EOF

DarienRaymond commented 6 years ago

2.47 应该已经修复了这个问题