v2ray / v2ray-core

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

fatal error: runtime: out of memory #980

Closed ba573318 closed 6 years ago

ba573318 commented 6 years ago

Please skip to the English section below if you don't write Chinese.

中文: 提交 Issue 之前请先阅读 Issue 指引,然后回答下面的问题,谢谢。 除非特殊情况,请完整填写所有问题。不按模板发的 issue 将直接被关闭。

1) 你正在使用哪个版本的 V2Ray?(如果服务器和客户端使用了不同版本,请注明) v3.14 2) 你的使用场景是什么?比如使用 Chrome 通过 Socks/VMess 代理观看 YouTube 视频。 使用R7000 merlin固件进行透明代理(Websocket + TLS + Web) 3) 你看到的不正常的现象是什么?(请描述具体现象,比如访问超时,TLS 证书错误等) 经常性程序崩溃,显示记忆体不足 4) 你期待看到的正确表现是怎样的? 稳定运行 5) 请附上你的配置(提交 Issue 前请隐藏服务器端IP地址)。

服务器端配置:
{
        "log": {
                "access": "/var/log/v2ray/access.log",
                "error": "/var/log/v2ray/error.log",
                "loglevel": "info"
        },
        "inbound": {
                "port": 10000,
                "listen": "127.0.0.1",
                "protocol": "vmess",
                "allocate": {
                        "strategy": "always"
                },
                "settings": {
                        "clients": [{
                                "id": "------屏蔽------",
                                "level": 1,
                                "alterId": 64,
                                "security": "chacha20-poly1305"
                        }]
                },
                "streamSettings": {
                        "network": "ws",
                        "wsSettings": {
                                "connectionReuse": false,
                                "path": "/phpmyadmin/"
                        }
                }
        },
        "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"
                        }]
                }
        }
}
客户端配置:
Chain PREROUTING (policy ACCEPT)
target     prot opt source               destination
VSERVER    all  --  anywhere             124.89.184.227
VSERVER    all  --  anywhere             169.254.23.173
V2RAY      tcp  --  anywhere             anywhere

Chain INPUT (policy ACCEPT)
target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

Chain POSTROUTING (policy ACCEPT)
target     prot opt source               destination
PUPNP      all  --  anywhere             anywhere
MASQUERADE  all  -- !124.89.184.227       anywhere
MASQUERADE  all  -- !169.254.23.173       anywhere
MASQUERADE  all  --  localhost/24         localhost/24

Chain DNSFILTER (0 references)
target     prot opt source               destination

Chain LOCALSRV (0 references)
target     prot opt source               destination

Chain PCREDIRECT (0 references)
target     prot opt source               destination

Chain PUPNP (1 references)
target     prot opt source               destination

Chain V2RAY (1 references)
target     prot opt source               destination
RETURN     all  --  anywhere             0.0.0.0/8
RETURN     all  --  anywhere             localhost/8
RETURN     all  --  anywhere             127.0.0.0/8
RETURN     all  --  anywhere             169.254.0.0/16
RETURN     all  --  anywhere             localhost/12
RETURN     all  --  anywhere             localhost/16
RETURN     all  --  anywhere             base-address.mcast.net/4
RETURN     all  --  anywhere             240.0.0.0/4
REDIRECT   tcp  --  anywhere             anywhere             redir ports 12345

Chain VSERVER (2 references)
target     prot opt source               destination
VUPNP      all  --  anywhere             anywhere

Chain VUPNP (1 references)
target     prot opt source               destination
DNAT       udp  --  anywhere             anywhere             udp dpt:35308 to:192.168.1.142:35308
DNAT       udp  --  anywhere             anywhere             udp dpt:39532 to:192.168.1.60:39532
DNAT       udp  --  anywhere             anywhere             udp dpt:33938 to:192.168.1.60:33938
DNAT       udp  --  anywhere             anywhere             udp dpt:34731 to:192.168.1.60:34731
DNAT       udp  --  anywhere             anywhere             udp dpt:41226 to:192.168.1.142:41226

admin@R7000-4485:/jffs/v2ray# cat /proc/cpuinfo
Processor       : ARMv7 Processor rev 0 (v7l)
processor       : 0
BogoMIPS        : 1998.84

processor       : 1
BogoMIPS        : 1998.84

Features        : swp half thumb fastmult edsp
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x3
CPU part        : 0xc09
CPU revision    : 0

Hardware        : Northstar Prototype
Revision        : 0000
Serial          : 0000000000000000
admin@R7000-4485:/jffs/v2ray# cat /proc/meminfo
MemTotal:         255716 kB
MemFree:          186060 kB
Buffers:             880 kB
Cached:            13048 kB
SwapCached:            0 kB
Active:            27416 kB
Inactive:          10872 kB
Active(anon):      24944 kB
Inactive(anon):      444 kB
Active(file):       2472 kB
Inactive(file):    10428 kB
Unevictable:           0 kB
Mlocked:               0 kB
SwapTotal:             0 kB
SwapFree:              0 kB
Dirty:                 0 kB
Writeback:             0 kB
AnonPages:         24372 kB
Mapped:            10332 kB
Shmem:              1028 kB
Slab:              15892 kB
SReclaimable:       1372 kB
SUnreclaim:        14520 kB
KernelStack:         808 kB
PageTables:          904 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:      127856 kB
Committed_AS:      59904 kB
VmallocTotal:     516096 kB
VmallocUsed:       18096 kB
VmallocChunk:     475812 kB

{
  "log": {
    "access": "",
    "error": "",
    "loglevel": ""
  },
  "inbound": {
    "port": 1085,
    "listen": "0.0.0.0",
    "protocol": "socks",
    "settings": {
      "auth": "noauth",
      "udp": true,
      "ip": "127.0.0.1",
      "clients": null
    },
    "streamSettings": null
  },
  "outbound": {
    "tag": "agentout",
    "protocol": "vmess",
    "settings": {
      "vnext": [
        {
          "address": "------屏蔽------",
          "port": 443,
          "users": [
            {
              "id": "------屏蔽------",
              "alterId": 64,
              "security": "chacha20-poly1305"
            }
          ]
        }
      ]
    },
    "streamSettings": {
      "network": "ws",
      "security": "tls",
      "tcpSettings": null,
      "kcpSettings": null,
      "wsSettings": {
        "connectionReuse": true,
        "path": "/phpmyadmin/",
        "headers": null
      }
    },
    "mux": {
      "enabled": true
    }
  },
      "inboundDetour": [
        {
            "domainOverride": ["tls","http"],
            "port": 12345,
            "protocol": "dokodemo-door",
            "settings": {
                "network": "tcp,udp",
                "followRedirect": true
            }
        }
    ],
  "outboundDetour": [
    {
      "protocol": "freedom",
      "settings": {
        "response": null
      },
      "tag": "direct"
    },
    {
      "protocol": "blackhole",
      "settings": {
        "response": {
          "type": "http"
        }
      },
      "tag": "blockout"
    }
  ],
  "dns": {
    "servers": [
      "8.8.8.8",
      "8.8.4.4",
      "localhost"
    ]
  },
  "routing": {
    "strategy": "rules",
    "settings": {
      "domainStrategy": "IPIfNonMatch",
      "rules": [
        {
          "type": "field",
          "port": null,
          "outboundTag": "direct",
          "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"
          ],
          "domain": null
        },
        {
          "type": "field",
          "port": null,
          "outboundTag": "direct",
          "ip": null,
          "domain": [
            "geosite:cn"
          ]
        },
        {
          "type": "field",
          "port": null,
          "outboundTag": "direct",
          "ip": [
            "geoip:cn"
          ],
          "domain": null
        }
      ]
    }
  }
}

6) 请附上出错时软件输出的错误日志。在 Linux 中,日志通常在 /var/log/v2ray/error.log 文件中。

服务器端错误日志:
    // 在这里附上服务器端日志
客户端错误日志:
2018/03/23 05:04:52 [Info] App|Router: looking for IP for domain: sdk.conf.igexin.com
2018/03/23 05:04:52 [Debug] App|DNS: add pending request id 39066
2018/03/23 05:04:52 [Debug] Transport|Internet|UDP: dispatch request to: udp:8.8.8.8:53
2018/03/23 05:04:52 [Debug] [465967795] Proxy|Dokodemo: processing connection from: 192.168.1.60:58322
2018/03/23 05:04:52 [Info] [1152074721] App|Dispatcher: sniffed domain: frontier.snssdk.com
2018/03/23 05:04:52 [Info] App|Router: looking for IP for domain: frontier.snssdk.com
2018/03/23 05:04:52 [Info] [1152074721] App|Dispatcher: taking detour [direct] for [tcp:frontier.snssdk.com:443]
2018/03/23 05:04:52 [Info] [1152074721] Proxy|Freedom: opening connection to tcp:frontier.snssdk.com:443
2018/03/23 05:04:52 [Info] [1152074721] Transport|Internet|TCP: dialing TCP to tcp:frontier.snssdk.com:443
2018/03/23 05:04:52 [Info] [465967795] App|Dispatcher: sniffed domain: stats.jpush.cn
2018/03/23 05:04:52 [Info] [465967795] App|Dispatcher: taking detour [direct] for [tcp:stats.jpush.cn:443]
2018/03/23 05:04:52 [Info] [465967795] Proxy|Freedom: opening connection to tcp:stats.jpush.cn:443
2018/03/23 05:04:52 [Info] [465967795] Transport|Internet|TCP: dialing TCP to tcp:stats.jpush.cn:443
2018/03/23 05:04:52 [Debug] App|DNS: handling response for id 39066 content: ;; opcode: QUERY, status: NOERROR, id: 39066
;; flags: qr rd ra; QUERY: 1, ANSWER: 11, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;sdk.conf.igexin.com.   IN       A

;; ANSWER SECTION:
sdk.conf.igexin.com.    59      IN      CNAME   iduvksz.qiniudns.com.
iduvksz.qiniudns.com.   9       IN      CNAME   tiny34.china.line.qiniudns.com.
tiny34.china.line.qiniudns.com. 485     IN      CNAME   chinacdnweb.qiniu.com.w.kunlunno.com.
chinacdnweb.qiniu.com.w.kunlunno.com.   179     IN      A       124.200.113.146
chinacdnweb.qiniu.com.w.kunlunno.com.   179     IN      A       124.200.113.165
chinacdnweb.qiniu.com.w.kunlunno.com.   179     IN      A       124.200.113.162
chinacdnweb.qiniu.com.w.kunlunno.com.   179     IN      A       124.200.113.148
chinacdnweb.qiniu.com.w.kunlunno.com.   179     IN      A       124.200.113.164
chinacdnweb.qiniu.com.w.kunlunno.com.   179     IN      A       124.200.113.147
chinacdnweb.qiniu.com.w.kunlunno.com.   179     IN      A       124.200.113.145
chinacdnweb.qiniu.com.w.kunlunno.com.   179     IN      A       124.200.113.161

2018/03/23 05:04:52 [Debug] App|DNS: returning 8 IPs for domain sdk.conf.igexin.com.
2018/03/23 05:04:52 [Info] [1324678353] App|Dispatcher: taking detour [direct] for [tcp:sdk.conf.igexin.com:80]
2018/03/23 05:04:52 [Info] [1324678353] Proxy|Freedom: opening connection to tcp:sdk.conf.igexin.com:80
2018/03/23 05:04:52 [Info] [1324678353] Transport|Internet|TCP: dialing TCP to tcp:sdk.conf.igexin.com:80
2018/03/23 05:04:52 [Debug] [1485969484] Proxy|Dokodemo: processing connection from: 192.168.1.60:44546
2018/03/23 05:04:52 [Debug] [4089447185] Proxy|Dokodemo: processing connection from: 192.168.1.60:58784
2018/03/23 05:04:52 [Info] [1485969484] App|Dispatcher: sniffed domain: cloudconfig.googleapis.com
2018/03/23 05:04:52 [Info] App|Router: looking for IP for domain: cloudconfig.googleapis.com
2018/03/23 05:04:52 [Debug] App|DNS: add pending request id 32609
2018/03/23 05:04:52 [Debug] Transport|Internet|UDP: dispatch request to: udp:8.8.8.8:53
2018/03/23 05:04:52 [Info] [4089447185] App|Dispatcher: sniffed domain: android.clients.google.com
2018/03/23 05:04:52 [Info] App|Router: looking for IP for domain: android.clients.google.com
2018/03/23 05:04:52 [Info] [4089447185] App|Dispatcher: default route for tcp:android.clients.google.com:443
2018/03/23 05:04:52 [Info] [4089447185] App|Proxyman|Mux: dispatching request to tcp:android.clients.google.com:443
2018/03/23 05:04:52 [Debug] App|DNS: handling response for id 32609 content: ;; opcode: QUERY, status: NOERROR, id: 32609
;; flags: qr rd ra; QUERY: 1, ANSWER: 6, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;cloudconfig.googleapis.com.    IN       A

;; ANSWER SECTION:
cloudconfig.googleapis.com.     3450    IN      CNAME   googleapis.l.google.com.
googleapis.l.google.com.        150     IN      A       216.58.200.42
googleapis.l.google.com.        150     IN      A       172.217.160.74
googleapis.l.google.com.        150     IN      A       216.58.200.234
googleapis.l.google.com.        150     IN      A       172.217.160.106
googleapis.l.google.com.        150     IN      A       172.217.24.10

2018/03/23 05:04:52 [Debug] App|DNS: returning 5 IPs for domain cloudconfig.googleapis.com.
2018/03/23 05:04:52 [Info] [1485969484] App|Dispatcher: default route for tcp:cloudconfig.googleapis.com:443
2018/03/23 05:04:52 [Info] [1485969484] App|Proxyman|Mux: dispatching request to tcp:cloudconfig.googleapis.com:443
fatal error: runtime: out of memory

runtime stack:
runtime.throw(0x59e4b4, 0x16)
        /usr/local/go/src/runtime/panic.go:619 +0x60
runtime.sysMap(0x13a00000, 0x100000, 0x1, 0x8afef0)
        /usr/local/go/src/runtime/mem_linux.go:227 +0x11c
runtime.(*mheap).sysAlloc(0x8a3060, 0x100000, 0x31301)
        /usr/local/go/src/runtime/malloc.go:470 +0x23c
runtime.(*mheap).grow(0x8a3060, 0x8, 0x0)
        /usr/local/go/src/runtime/mheap.go:907 +0x48
runtime.(*mheap).allocSpanLocked(0x8a3060, 0x3, 0x8aff00, 0x10b4bf84)
        /usr/local/go/src/runtime/mheap.go:820 +0x30c
runtime.(*mheap).alloc_m(0x8a3060, 0x3, 0x10059, 0x11758)
        /usr/local/go/src/runtime/mheap.go:686 +0x118
runtime.(*mheap).alloc.func1()
        /usr/local/go/src/runtime/mheap.go:753 +0x3c
runtime.(*mheap).alloc(0x8a3060, 0x3, 0x10059, 0x1)
        /usr/local/go/src/runtime/mheap.go:752 +0x60
runtime.(*mcentral).grow(0x8a5180, 0x0)
        /usr/local/go/src/runtime/mcentral.go:232 +0x94
runtime.(*mcentral).cacheSpan(0x8a5180, 0x0)

7) 请附上访问日志。在 Linux 中,日志通常在 /var/log/v2ray/access.log 文件中。

    // 在这里附上服务器端日志

8) 其它相关的配置文件(如 Nginx)和相关日志。

zaion520 commented 6 years ago

加虚拟内存就可以了