Skip to content

似乎是内存泄露问题? #5163

@CoronaZero

Description

@CoronaZero

完整性要求

  • 我读完了 issue 模板中的所有注释,确保填写符合要求。
  • 我保证阅读了文档,了解所有我编写的配置文件项的含义,而不是大量堆砌看似有用的选项或默认值。
  • 我提供了完整的配置文件和日志,而不是出于自己的判断只给出截取的部分。
  • 我搜索了 issues, 没有发现已提出的类似问题。
  • 问题在 Release 最新的版本上可以成功复现

描述

版本号: v25.9.11

操作系统: Debian 13.0 x64

使用方式是链式代理:
A(国内机器)
B(海外线路机器)
C(落地机器)

客户端连接到 A ,A 使用 shadowsocks 2022 入站

B 提供一个 Reality + vision + VLESS 入站,作为中转

C 提供一个 Shadowsocks 2022 入站,作为落地

由机器 A 通过链式代理连接 B 再到 C 。


Server 1 落地机器

Image

Image

server1-allocs.txt

server1-goroutine.txt

server1-heap.txt

Server 2 国内机器

Image

Image

server2-allocs.txt

server2-goroutine.txt

server2-heap.txt

重现方式

服务器端配置完成后,手机上使用 v2rayN ,电脑端使用 v2rayNG (均为最新版本,内核使用 Xray-core v25.9.11 ),日常使用一段时间(快则 2-3 小时,慢则 12+ 小时,取决于使用情况),服务器服务器内存被 Xray 占用过多,同时如果此时产生新连接,服务器 CPU 也会飙升。

客户端配置

由 v2rayN 导出后,隐去隐私部分


{
  "log": {
    "loglevel": "warning"
  },
  "dns": {
    "hosts": {
      "dns.google": [
        "8.8.8.8",
        "8.8.4.4",
        "2001:4860:4860::8888",
        "2001:4860:4860::8844"
      ],
      "dns.alidns.com": [
        "223.5.5.5",
        "223.6.6.6",
        "2400:3200::1",
        "2400:3200:baba::1"
      ],
      "one.one.one.one": [
        "1.1.1.1",
        "1.0.0.1",
        "2606:4700:4700::1111",
        "2606:4700:4700::1001"
      ],
      "1dot1dot1dot1.cloudflare-dns.com": [
        "1.1.1.1",
        "1.0.0.1",
        "2606:4700:4700::1111",
        "2606:4700:4700::1001"
      ],
      "cloudflare-dns.com": [
        "104.16.249.249",
        "104.16.248.249",
        "2606:4700::6810:f8f9",
        "2606:4700::6810:f9f9"
      ],
      "dns.cloudflare.com": [
        "104.16.132.229",
        "104.16.133.229",
        "2606:4700::6810:84e5",
        "2606:4700::6810:85e5"
      ],
      "dot.pub": [
        "1.12.12.12",
        "120.53.53.53"
      ],
      "dns.quad9.net": [
        "9.9.9.9",
        "149.112.112.112",
        "2620:fe::fe",
        "2620:fe::9"
      ],
      "dns.yandex.net": [
        "77.88.8.8",
        "77.88.8.1",
        "2a02:6b8::feed:0ff",
        "2a02:6b8:0:1::feed:0ff"
      ],
      "dns.sb": [
        "185.222.222.222",
        "2a09::"
      ],
      "dns.umbrella.com": [
        "208.67.220.220",
        "208.67.222.222",
        "2620:119:35::35",
        "2620:119:53::53"
      ],
      "dns.sse.cisco.com": [
        "208.67.220.220",
        "208.67.222.222",
        "2620:119:35::35",
        "2620:119:53::53"
      ],
      "engage.cloudflareclient.com": [
        "162.159.192.1",
        "2606:4700:d0::a29f:c001"
      ]
    },
    "servers": [
      {
        "address": "https://cloudflare-dns.com/dns-query",
        "domains": [
          "domain:googleapis.cn",
          "domain:gstatic.com"
        ],
        "skipFallback": true
      },
      {
        "address": "https://dns.alidns.com/dns-query",
        "domains": [
          "geosite:apple",
          "geosite:private",
          "geosite:cn"
        ],
        "skipFallback": true
      },
      "https://cloudflare-dns.com/dns-query"
    ],
    "tag": "dns-module"
  },
  "inbounds": [
    {
      "tag": "socks",
      "port": 10808,
      "listen": "0.0.0.0",
      "protocol": "mixed",
      "sniffing": {
        "enabled": true,
        "destOverride": [
          "http",
          "tls"
        ],
        "routeOnly": false
      },
      "settings": {
        "auth": "noauth",
        "udp": true,
        "allowTransparent": false
      }
    },
    {
      "tag": "api",
      "port": 10812,
      "listen": "127.0.0.1",
      "protocol": "dokodemo-door",
      "settings": {
        "address": "127.0.0.1"
      }
    }
  ],
  "outbounds": [
    {
      "tag": "proxy",
      "protocol": "shadowsocks",
      "settings": {
        "servers": [
          {
            "address": "IP",
            "method": "2022-blake3-aes-256-gcm",
            "ota": false,
            "password": "+cxUQwWEMFaSc54PqpZCtSEy3nYx4Az6kVtgrAAK2XU=",
            "port": 55555,
            "level": 1
          }
        ]
      },
      "streamSettings": {
        "network": "tcp"
      },
      "mux": {
        "enabled": false,
        "concurrency": -1
      }
    },
    {
      "tag": "direct",
      "protocol": "freedom"
    },
    {
      "tag": "block",
      "protocol": "blackhole"
    }
  ],
  "routing": {
    "domainStrategy": "IPIfNonMatch",
    "rules": [
      {
        "type": "field",
        "inboundTag": [
          "api"
        ],
        "outboundTag": "api"
      },
      {
        "type": "field",
        "outboundTag": "direct",
        "domain": [
          "geosite:apple"
        ]
      },
      {
        "type": "field",
        "outboundTag": "proxy",
        "domain": [
          "domain:googleapis.cn",
          "domain:gstatic.com"
        ]
      },
      {
        "type": "field",
        "port": "443",
        "network": "udp",
        "outboundTag": "block"
      },
      {
        "type": "field",
        "outboundTag": "block",
        "domain": [
          "geosite:category-ads-all"
        ]
      },
      {
        "type": "field",
        "outboundTag": "direct",
        "ip": [
          "geoip:private"
        ]
      },
      {
        "type": "field",
        "outboundTag": "direct",
        "domain": [
          "geosite:private"
        ]
      },
      {
        "type": "field",
        "outboundTag": "direct",
        "ip": [
          "223.5.5.5",
          "223.6.6.6",
          "2400:3200::1",
          "2400:3200:baba::1",
          "119.29.29.29",
          "1.12.12.12",
          "120.53.53.53",
          "2402:4e00::",
          "2402:4e00:1::",
          "180.76.76.76",
          "2400:da00::6666",
          "114.114.114.114",
          "114.114.115.115",
          "114.114.114.119",
          "114.114.115.119",
          "114.114.114.110",
          "114.114.115.110",
          "180.184.1.1",
          "180.184.2.2",
          "101.226.4.6",
          "218.30.118.6",
          "123.125.81.6",
          "140.207.198.6",
          "1.2.4.8",
          "210.2.4.8",
          "52.80.66.66",
          "117.50.22.22",
          "2400:7fc0:849e:200::4",
          "2404:c2c0:85d8:901::4",
          "117.50.10.10",
          "52.80.52.52",
          "2400:7fc0:849e:200::8",
          "2404:c2c0:85d8:901::8",
          "117.50.60.30",
          "52.80.60.30"
        ]
      },
      {
        "type": "field",
        "outboundTag": "direct",
        "domain": [
          "domain:alidns.com",
          "domain:doh.pub",
          "domain:dot.pub",
          "domain:360.cn",
          "domain:onedns.net"
        ]
      },
      {
        "type": "field",
        "outboundTag": "direct",
        "ip": [
          "geoip:cn"
        ]
      },
      {
        "type": "field",
        "outboundTag": "direct",
        "domain": [
          "geosite:cn"
        ]
      },
      {
        "type": "field",
        "port": "0-65535",
        "outboundTag": "proxy"
      },
      {
        "type": "field",
        "inboundTag": [
          "dns-module"
        ],
        "outboundTag": "proxy"
      }
    ]
  },
  "metrics": {
    "tag": "api"
  },
  "policy": {
    "system": {
      "statsOutboundUplink": true,
      "statsOutboundDownlink": true
    }
  },
  "stats": {}
}

服务端配置

服务器 A 配置文件(国内机器)


{
    "log": {
        "loglevel": "warning"
    },
    "dns": {
        "servers": [
            {
                "address": "https://223.5.5.5/dns-query",
                "domains": [
                    "geosite:cn"
                ],
                "skipFallback": false
            },
            "https://1.1.1.1/dns-query"
        ]
    },
    "inbounds": [
        {
            "tag": "Local-socks",
            "port": 10808,
            "listen": "127.0.0.1",
            "protocol": "mixed",
            "sniffing": {
                "enabled": true,
                "destOverride": [
                    "http",
                    "tls"
                ],
                "routeOnly": false
            },
            "settings": {
                "auth": "noauth",
                "udp": true,
                "allowTransparent": false
            }
        },
        {
            "tag": "IN-ss",
            "port": 55555,
            "protocol": "shadowsocks",
            "settings": {
                "method": "2022-blake3-aes-256-gcm",
                "password": "+cxUQwWEMFaSc54PqpZCtSEy3nYx4Az6kVtgrAAK2XU=",
                "network": "tcp"
            }
        }
    ],
    "outbounds": [
        {
            "tag": "AWS-LUO-ss",
            "protocol": "shadowsocks",
            "settings": {
                "servers": [
                    {
                        "address": "IP",
                        "method": "2022-blake3-aes-256-gcm",
                        "password": "XlNvvlTgVxv6KVeUG+B4cpHKjZ3+BnK1a0u1zRc4L9E=",
                        "port": 55555
                    }
                ]
            },
            "streamSettings": {
                "network": "tcp",
                "sockopt": {
                    "dialerProxy": "AWS-JP-Reality"
                }
            }
        },
        {
            "tag": "AWS-JP-Reality",
            "protocol": "vless",
            "settings": {
                "vnext": [
                    {
                        "address": "IPIP",
                        "port": 56565,
                        "users": [
                            {
                                "id": "an id",
                                "security": "auto",
                                "encryption": "none",
                                "flow": "xtls-rprx-vision"
                            }
                        ]
                    }
                ]
            },
            "streamSettings": {
                "network": "tcp",
                "security": "reality",
                "realitySettings": {
                    "serverName": "www.apple.com",
                    "fingerprint": "chrome",
                    "publicKey": "akey...",
                    "shortId": "fafafa"
                }
            }
        },
        {
            "tag": "direct",
            "protocol": "freedom"
        },
        {
            "tag": "block",
            "protocol": "blackhole"
        }
    ],
    "routing": {
        "domainStrategy": "IPIfNonMatch",
        "rules": [
            {
                "ip": [
                    "geoip:private",
                    "geoip:cn",
                    "223.5.5.5"
                ],
                "outboundTag": "direct"
            },
            {
                "domain": [
                    "geosite:cn"
                ],
                "outboundTag": "direct"
            },
            {
                "domain": [
                    "domain:gstatic.com",
                    "domain:googleapis.cn"
                ],
                "outboundTag": "AWS-LUO-ss"
            },
            {
                "domain": [
                    "geosite:category-ads-all"
                ],
                "outboundTag": "block"
            }
        ]
    }
}

服务器 C 配置文件(落地机器)


{
    "log": {
        "loglevel": "warning"
    },
    "dns": {
        "servers": [
            {
                "address": "1.14.5.14",
                "domains": [
                    "geosite:netflix",
                    "geosite:openai",
                    "geosite:google"
                ],
                "skipFallback": false
            },
            "https://1.1.1.1/dns-query"
        ],
        "tag": "DNS"
    },
    "inbounds": [
        {
            "tag": "IN-ss",
            "port": 55555,
            "protocol": "shadowsocks",
            "settings": {
                "method": "2022-blake3-aes-256-gcm",
                "password": "XlNvvlTgVxv6KVeUG+B4cpHKjZ3+BnK1a0u1zRc4L9E=",
                "network": "tcp,udp"
            }
        }
    ],
    "outbounds": [
        {
            "tag": "direct",
            "protocol": "freedom",
            "settings": {
                "domainStrategy": "UseIPv4v6"
            }
        },
        {
            "tag": "block",
            "protocol": "blackhole"
        }
    ],
    "routing": {
        "domainStrategy": "IPIfNonMatch",
        "rules": [
            {
                "inboundTag": [
                    "DNS"
                ],
                "outboundTag": "direct"
            },
            {
                "domain": [
                    "domain:gstatic.com",
                    "domain:googleapis.cn"
                ],
                "outboundTag": "direct"
            },
            {
                "ip": [
                    "geoip:private",
                    "geoip:cn"
                ],
                "outboundTag": "block"
            },
            {
                "domain": [
                    "geosite:category-ads-all",
                    "geosite:cn"
                ],
                "outboundTag": "block"
            }
        ]
    }
}

P.S. 我曾以为是中间线路机器 B 的问题,但是测试后发现 B 无论是使用 vmess-ws-tls 还是 vless-xhttp-tls 还是 trojan 作为中间机器 B 的入站配置,都会导致 A 和 C 内存泄露,且 B 没有内存泄露问题,因此这里未提供,见谅。

客户端日志

由于需要造成泄露的时间比较长,且客户端日志涉及隐私比较多……请见谅。

服务端日志

日志未写到文件,且每次内存泄露都必须强制重启解决……

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions