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

out of memory错误

Open codetang-2417 opened this issue 1 year ago • 1 comments

除非特殊情况,请完整填写所有问题。不按模板发的 issue 将直接被关闭。 如果你遇到的问题不是 V2Ray 的 bug,比如你不清楚要如何配置,请使用Discussion进行讨论。

  1. 你正在使用哪个版本的 V2Ray?(如果服务器和客户端使用了不同版本,请注明)
    ~  v2ray version                                                                                                                                                                  ✔ 
V2Ray 5.7.0 (V2Fly, a community-driven edition of V2Ray.) Custom (go1.20.4 linux/amd64)
A unified platform for anti-censorship.
  1. 你的使用场景是什么?比如使用 Chrome 通过 Socks/VMess 代理观看 YouTube 视频。 使用v2rayA订阅和管理v2ray的代理,一般使用Chrome代理,查询资料之类的。 image

  2. 你看到的不正常的现象是什么?(请描述具体现象,比如访问超时,TLS 证书错误等) 凌晨1点多电脑自动重启了,查看日志发现可能是v2ray内存溢出导致的。我有两台电脑,其中一台偶尔会出现v2ray占用所有cpu全功率运行,并且也沾满了内存。但是不会导致重启。而在这一台电脑上占用全部内存可能会导致重启发生。两台电脑都是通过v2rayA管理订阅。

  3. 你期待看到的正确表现是怎样的? 修复偶尔超出内存的bug

  4. 请附上你的配置(提交 Issue 前请隐藏服务器端IP地址)。

服务器端配置:

    // 在这里附上服务器端配置文件
订阅方式获取的,不清楚配置

客户端配置:

    // Config file of V2Ray. This file follows standard JSON format, with comments support.
// Uncomment entries below to satisfy your needs. Also read our manual for more detail at
// https://www.v2fly.org/
{
  "log": {
    // By default, V2Ray writes access log to stdout.
    // "access": "/path/to/access/log/file",

    // By default, V2Ray write error log to stdout.
    // "error": "/path/to/error/log/file",

    // Log level, one of "debug", "info", "warning", "error", "none"
    "loglevel": "warning"
  },
  // List of inbound proxy configurations.
  "inbounds": [{
    // Port to listen on. You may need root access if the value is less than 1024.
    "port": 1080,

    // IP address to listen on. Change to "0.0.0.0" to listen on all network interfaces.
    "listen": "127.0.0.1",

    // Tag of the inbound proxy. May be used for routing.
    "tag": "socks-inbound",

    // Protocol name of inbound proxy.
    "protocol": "socks",

    // Settings of the protocol. Varies based on protocol.
    "settings": {
      "auth": "noauth",
      "udp": false,
      "ip": "127.0.0.1"
    },

    // Enable sniffing on TCP connection.
    "sniffing": {
      "enabled": true,
      // Target domain will be overriden to the one carried by the connection, if the connection is HTTP or HTTPS.
      "destOverride": ["http", "tls"]
    }
  }],
  // List of outbound proxy configurations.
  "outbounds": [{
    // Protocol name of the outbound proxy.
    "protocol": "freedom",

    // Settings of the protocol. Varies based on protocol.
    "settings": {},

    // Tag of the outbound. May be used for routing.
    "tag": "direct"
  },{
    "protocol": "blackhole",
    "settings": {},
    "tag": "blocked"
  }],

  // Transport is for global transport settings. If you have multiple transports with same settings
  // (say mKCP), you may put it here, instead of in each individual inbound/outbounds.
  //"transport": {},

  // Routing controls how traffic from inbounds are sent to outbounds.
  "routing": {
    "domainStrategy": "IPOnDemand",
    "rules":[
      {
        // Blocks access to private IPs. Remove this if you want to access your router.
        "type": "field",
        "ip": ["geoip:private"],
        "outboundTag": "blocked"
      },
      {
        // Blocks major ads.
        "type": "field",
        "domain": ["geosite:category-ads"],
        "outboundTag": "blocked"
      }
    ]
  },

  // Dns settings for domain resolution.
  "dns": {
    // Static hosts, similar to hosts file.
    "hosts": {
      // Match v2fly.org to another domain on CloudFlare. This domain will be used when querying IPs for v2fly.org.
      "domain:v2fly.org": "www.vicemc.net",

      // The following settings help to eliminate DNS poisoning in mainland China.
      // It is safe to comment these out if this is not the case for you.
      "domain:github.io": "pages.github.com",
      "domain:wikipedia.org": "www.wikimedia.org",
      "domain:shadowsocks.org": "electronicsrealm.com"
    },
    "servers": [
      "1.1.1.1",
      {
        "address": "114.114.114.114",
        "port": 53,
        // List of domains that use this DNS first.
        "domains": [
          "geosite:cn"
        ]
      },
      "8.8.8.8",
      "localhost"
    ]
  },

  // Policy controls some internal behavior of how V2Ray handles connections.
  // It may be on connection level by user levels in 'levels', or global settings in 'system.'
  "policy": {
    // Connection policys by user levels
    "levels": {
      "0": {
        "uplinkOnly": 0,
        "downlinkOnly": 0
      }
    },
    "system": {
      "statsInboundUplink": false,
      "statsInboundDownlink": false,
      "statsOutboundUplink": false,
      "statsOutboundDownlink": false
    }
  },

  // Stats enables internal stats counter.
  // This setting can be used together with Policy and Api. 
  //"stats":{},

  // Api enables gRPC APIs for external programs to communicate with V2Ray instance.
  //"api": {
    //"tag": "api",
    //"services": [
    //  "HandlerService",
    //  "LoggerService",
    //  "StatsService"
    //]
  //},

  // You may add other entries to the configuration, but they will not be recognized by V2Ray.
  "other": {}
}

v2rayA

  1. 请附上出错时软件输出的错误日志。在 Linux 中,日志通常在 /var/log/v2ray/error.log 文件中。 /var/log/下面我没有找到有v2ray的文件夹,只有v2raya的 服务器端错误日志:
    // 在这里附上服务器端日志

客户端错误日志:

    // 在这里附上客户端日志
2023/09/28 01:01:41.592  [A] [main.go:29]  V2Ray binary is /usr/bin/v2ray
2023/09/28 01:01:41.592  [A] [main.go:29]  V2Ray asset directory is /run/user/0/v2raya
2023/09/28 01:01:41.592  [A] [main.go:29]  v2rayA working directory is /
2023/09/28 01:01:41.592  [A] [main.go:29]  v2rayA configuration directory is /etc/v2raya
2023/09/28 01:01:41.592  [A] [main.go:29]  Golang: go1.21.1
2023/09/28 01:01:41.592  [A] [main.go:29]  OS: linux
2023/09/28 01:01:41.592  [A] [main.go:29]  Arch: amd64
2023/09/28 01:01:41.592  [A] [main.go:29]  Lite: false
2023/09/28 01:01:41.592  [A] [main.go:29]  Version: 2.2.4
2023/09/28 01:01:41.592  [A] [main.go:29]  Starting...
2023/09/28 01:01:41.595  [W] [v2ray.go:222]  IsDatetimeSynced: lookup ntp.aliyun.com: Temporary failure in name resolution
2023/09/28 01:01:41.595  [W] [pre.go:231]  UpdateSubscription: Get "https://tt.vg/freev2": dial tcp: lookup tt.vg: Temporary failure in name resolution: []
2023/09/28 01:01:41.595  [W] [asm_amd64.s:1650]  Failed to update PAC file: failed to get latest version of GFWList: Get "https://hubmirror.v2raya.org/api/v2rayA/dist-v2ray-rules-dat/tags": dial tcp: lookup hubmirror.v2raya.org: Temporary failure in name resolution
2023/09/28 01:01:41.595  [I] [asm_amd64.s:1650]  [AutoUpdate] Subscriptions: Failed to update subscription -- ID: 0,err: UpdateSubscription: failed to resolve subscription address: Get "https://tt.vg/freev2": dial tcp: lookup tt.vg: Temporary failure in name resolution
2023/09/28 01:01:41.623  [I] [io.go:432]  V2Ray 5.7.0 (V2Fly, a community-driven edition of V2Ray.) Custom (go1.20.4 linux/amd64)
2023/09/28 01:01:41.623  [I] [io.go:432]  A unified platform for anti-censorship.
2023/09/28 01:01:41.954  [I] [io.go:432]  127.0.0.1:50998 accepted tcp:127.0.0.1:0 [api-out]
2023/09/28 01:01:41.964  [A] [index.go:116]  v2rayA is listening at http://127.0.0.1:2017
2023/09/28 01:01:41.964  [A] [index.go:116]  v2rayA is listening at http://[::1]:2017
2023/09/28 01:01:42.606  [I] [io.go:432]  127.0.0.1:51004 accepted tcp:127.0.0.1:0 [api-out]
2023/09/28 01:01:59.200  [I] [io.go:432]  127.0.0.1:41050 accepted udp:2.0.1.7:53 [dns-out]
...
2023/09/28 01:09:29.770  [I] [io.go:432]  127.0.0.1:39682 accepted udp:2.0.1.7:53 [dns-out]
2023/09/28 01:09:29.770  [I] [io.go:432]  127.0.0.1:60682 accepted udp:2.0.1.7:53 [dns-out]
2023/09/28 01:09:29.770  [I] [io.go:432]  127.0.0.1:43844 accepted udp:2.0.1.7:53 [dns-out]
2023/09/28 01:09:29.770  [I] [io.go:432]  127.0.0.1:46827 accepted udp:2.0.1.7:53 [dns-out]
2023/09/28 01:09:29.912  [W] [asm_amd64.s:1650]  ObservatoryProducer: rpc error: code = DeadlineExceeded desc = context deadline exceeded
2023/09/28 01:09:30.030  [I] [io.go:432]  127.0.0.1:33028 accepted udp:2.0.1.7:53 [dns-out]
2023/09/28 01:09:30.030  [I] [io.go:432]  127.0.0.1:46903 accepted udp:2.0.1.7:53 [dns-out]
2023/09/28 01:09:30.030  [I] [io.go:432]  127.0.0.1:41444 accepted udp:2.0.1.7:53 [dns-out]
...
2023/09/28 01:12:55.364  [I] [io.go:432]  127.0.0.1:51898 accepted udp:2.0.1.7:53 [dns-out]
2023/09/28 01:12:55.384  [I] [io.go:432]  127.0.0.1:54287 accepted udp:2.0.1.7:53 [dns-out]
2023/09/28 01:12:55.481  [W] [asm_amd64.s:1650]  ObservatoryProducer: rpc error: code = DeadlineExceeded desc = context deadline exceeded
2023/09/28 01:12:57.503  [W] [asm_amd64.s:1650]  ObservatoryProducer: rpc error: code = DeadlineExceeded desc = context deadline exceeded
2023/09/28 01:12:58.661  [I] [io.go:432]  127.0.0.1:39073 accepted udp:2.0.1.7:53 [dns-out]
2023/09/28 01:12:59.196  [I] [io.go:432]  127.0.0.1:35486 accepted udp:2.0.1.7:53 [dns-out]
2023/09/28 01:12:59.709  [W] [asm_amd64.s:1650]  ObservatoryProducer: rpc error: code = DeadlineExceeded desc = context deadline exceeded
2023/09/28 01:13:01.856  [W] [asm_amd64.s:1650]  ObservatoryProducer: rpc error: code = DeadlineExceeded desc = context deadline exceeded
2023/09/28 01:13:02.050  [I] [io.go:432]  127.0.0.1:47618 accepted udp:2.0.1.7:53 [dns-out]
2023/09/28 01:13:02.243  [I] [io.go:432]  127.0.0.1:44945 accepted udp:2.0.1.7:53 [dns-out]
2023/09/28 01:13:02.296  [I] [io.go:432]  127.0.0.1:39320 accepted udp:2.0.1.7:53 [dns-out]
2023/09/28 01:13:02.369  [I] [io.go:432]  127.0.0.1:40339 accepted udp:2.0.1.7:53 [dns-out]
2023/09/28 01:13:02.440  [I] [io.go:432]  127.0.0.1:60613 accepted udp:2.0.1.7:53 [dns-out]
2023/09/28 01:13:02.554  [I] [io.go:432]  127.0.0.1:52525 accepted udp:2.0.1.7:53 [dns-out]
2023/09/28 01:13:02.580  [I] [io.go:432]  127.0.0.1:34341 accepted udp:2.0.1.7:53 [dns-out]
2023/09/28 01:13:02.690  [I] [io.go:432]  127.0.0.1:39128 accepted udp:2.0.1.7:53 [dns-out]
2023/09/28 01:13:02.733  [I] [io.go:432]  127.0.0.1:38784 accepted udp:2.0.1.7:53 [dns-out]
2023/09/28 01:13:02.880  [I] [io.go:432]  127.0.0.1:44080 accepted udp:2.0.1.7:53 [dns-out]
2023/09/28 01:13:05.230  [W] [asm_amd64.s:1650]  ObservatoryProducer: rpc error: code = DeadlineExceeded desc = context deadline exceeded
2023/09/28 01:13:07.234  [W] [asm_amd64.s:1650]  ObservatoryProducer: rpc error: code = DeadlineExceeded desc = context deadline exceeded
2023/09/28 01:13:09.234  [W] [asm_amd64.s:1650]  ObservatoryProducer: rpc error: code = DeadlineExceeded desc = context deadline exceeded
2023/09/28 01:13:11.236  [W] [asm_amd64.s:1650]  ObservatoryProducer: rpc error: code = DeadlineExceeded desc = context deadline exceeded
2023/09/28 01:13:13.237  [W] [asm_amd64.s:1650]  ObservatoryProducer: rpc error: code = DeadlineExceeded desc = context deadline exceeded
2023/09/28 01:13:13.571  [W] [asm_amd64.s:1650]  v2ray-core: signal: killed
2023/09/28 01:13:15.252  [W] [asm_amd64.s:1650]  ObservatoryProducer: did not connect: context deadline exceeded
2023/09/28 01:13:16.253  [W] [asm_amd64.s:1650]  ObservatoryProducer: did not connect: context deadline exceeded


image image image

  1. 请附上访问日志。在 Linux 中,日志通常在 /var/log/v2ray/access.log 文件中。
    // 在这里附上服务器端日志
  1. 其它相关的配置文件(如 Nginx)和相关日志。

  2. 如果 V2Ray 无法启动,请附上 --test 输出。

通常的命令为 /usr/bin/v2ray/v2ray --test --config /etc/v2ray/config.json。请按实际情况修改。 卡在最后一行,一直没有输出

    ~  /usr/bin/v2ray test config /etc/v2ray/config.json                                                                                                                              ✔ 
V2Ray 5.7.0 (V2Fly, a community-driven edition of V2Ray.) Custom (go1.20.4 linux/amd64)
A unified platform for anti-censorship.
2023/09/28 10:12:33 Using config from STDIN
  1. 如果 V2Ray 服务运行不正常,请附上 journal 日志。

通常的命令为 journalctl -u v2ray

请预览一下你填的内容再提交。

codetang-2417 avatar Sep 28 '23 02:09 codetang-2417

这是解决方法以及该问题的原因: the solution of v2ray-core memory leak

codetang-2417 avatar Sep 28 '23 14:09 codetang-2417

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 27 '24 01:01 github-actions[bot]