Skip to content

v4.35.1 在 h2 模式下运行一段时间后开始无法连接到远端服务器 #772

@lijinglin3

Description

@lijinglin3

你正在使用哪个版本的 V2Ray?

v4.35.1

你的使用场景是什么?

使用 Chrome 通过 Socks/VMess 代理使用 GitHub

你看到的异常现象是什么?

每启动半个小时之后客户端开始无法连接到远端,重启客户端后恢复,半个小时后依然无法连接远端,如此往复
尝试重启过远端服务以及服务器,现象一致

你期待看到的正常表现是怎样的?

正常连接代理服务器

请附上你的配置

服务端配置:

// 在这里附上服务器端配置文件
{
  "log": {
    "loglevel": "warn",
    "access": "/var/log/v2ray/access.log",
    "error": "/var/log/v2ray/error.log"
  },
  "inbounds": [
    {
      "port": "1000",
      "listen": "127.0.0.1",
      "protocol": "vmess",
      "settings": {
        "clients": [
          {
            "id": "xxxxxxxx",
            "alterId": 64
          }
        ]
      },
      "streamSettings": {
        "network": "h2",
        "security": "tls",
        "httpSettings": {
          "path": "/xxxxxxxx",
          "host": [
            "xxxxxxxx"
          ]
        },
        "tlsSettings": {
          "serverName": "xxxxxxxx",
          "certificates": [
            {
              "certificateFile": "/etc/letsencrypt/live/xxxx/fullchain.pem",
              "keyFile": "/etc/letsencrypt/live/xxxx/privkey.pem"
            }
          ]
        }
      }
    },
    {
      "port": 1024,
      "listen": "127.0.0.1",
      "protocol": "vmess",
      "settings": {
        "clients": [
          {
            "id": "xxxxxxxx",
            "alterId": 64
          }
        ]
      },
      "streamSettings": {
        "network": "ws",
        "wsSettings": {
          "path": "/xxxxxxxx"
        }
      }
    }
  ],
  "outbounds": [
    {
      "protocol": "freedom",
      "settings": {}
    },
    {
      "protocol": "blackhole",
      "settings": {},
      "tag": "blocked"
    }
  ],
  "routing": {
    "rules": [
      {
        "type": "field",
        "ip": [
          "geoip:private"
        ],
        "outboundTag": "blocked"
      }
    ]
  }
}

客户端配置:

// 在这里附上客户端配置
{
  "inbounds": [
    {
      "protocol": "socks",
      "port": 1080,
      "listen": "0.0.0.0",
      "sniffing": {
        "enabled": true,
        "destOverride": [
          "http",
          "tls"
        ]
      }
    },
    {
      "protocol": "http",
      "port": 1081,
      "listen": "0.0.0.0",
      "sniffing": {
        "enabled": true,
        "destOverride": [
          "http",
          "tls"
        ]
      }
    }
  ],
  "outbounds": [
    {
      "protocol": "vmess",
      "settings": {
        "vnext": [
          {
            "address": "xxxxxxxx",
            "port": 443,
            "users": [
              {
                "id": "xxxxxxxx",
                "alterId": 64
              }
            ]
          }
        ]
      },
      "streamSettings": {
        "security": "tls",
        "network": "h2",
        "httpSettings": {
          "path": "/xxxxxxxx",
          "host": [
            "xxxxxxxx"
          ]
        }
      },
      "mux": {
        "enabled": true
      },
      "tag": "h2"
    },
    {
      "protocol": "vmess",
      "settings": {
        "vnext": [
          {
            "address": "xxxxxxxx",
            "port": 443,
            "users": [
              {
                "id": "xxxxxxxx",
                "alterId": 64
              }
            ]
          }
        ]
      },
      "streamSettings": {
        "network": "ws",
        "security": "tls",
        "wsSettings": {
          "path": "/xxxxxxxx"
        }
      },
      "mux": {
        "enabled": true
      },
      "tag": "cf"
    },
    {
      "protocol": "freedom",
      "settings": {},
      "tag": "direct"
    },
    {
      "protocol": "blackhole",
      "settings": {},
      "tag": "blocked"
    }
  ],
  "dns": {
    "servers": [
      {
        "address": "1.0.0.1",
        "port": 53,
        "domains": [
          "geosite:geolocation-!cn"
        ]
      },
      {
        "address": "1.1.1.1",
        "port": 53,
        "domains": [
          "geosite:geolocation-!cn"
        ]
      },
      "119.29.29.29",
      "119.28.28.28",
      "223.5.5.5",
      "223.6.6.6",
      "127.0.0.53"
    ]
  },
  "routing": {
    "domainStrategy": "IPOnDemand",
    "rules": [
      {
        "type": "field",
        "outboundTag": "blocked",
        "domain": [
          "geosite:category-ads"
        ]
      },
      {
        "type": "field",
        "outboundTag": "direct",
        "domain": [
          "geosite:cn"
        ]
      },
      {
        "type": "field",
        "outboundTag": "direct",
        "ip": [
          "geoip:cn",
          "geoip:private"
        ]
      },
      {
        "type": "field",
        "outboundTag": "h2",
        "network": "udp,tcp"
      }
    ]
  }
}

请附上出错时软件输出的错误日志

服务器端错误日志:

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

客户端错误日志:

// 在这里附上客户端日志
Mar 11 10:56:30 rog systemd[1]: Started V2Ray Service.
Mar 11 10:56:30 rog v2ray[2014813]: V2Ray 4.35.1 (V2Fly, a community-driven edition of V2Ray.) Custom (go1.16 linux/amd64)
Mar 11 10:56:30 rog v2ray[2014813]: A unified platform for anti-censorship.
Mar 11 10:56:30 rog v2ray[2014813]: 2021/03/11 10:56:30 [Info] github.com/v2fly/v2ray-core/v4/main/jsonem: Reading config: /usr/local/etc/v2ray/config.json
Mar 11 10:56:30 rog v2ray[2014813]: 2021/03/11 10:56:30 [Warning] github.com/v2fly/v2ray-core/v4: V2Ray 4.35.1 started
Mar 11 10:57:59 rog systemd[1]: /etc/systemd/system/v2ray.service:7: Special user nobody configured, this is not safe!
Mar 11 10:58:00 rog systemd[1]: /etc/systemd/system/v2ray.service:7: Special user nobody configured, this is not safe!
Mar 11 10:58:01 rog systemd[1]: /etc/systemd/system/v2ray.service:7: Special user nobody configured, this is not safe!
Mar 11 10:58:02 rog systemd[1]: /etc/systemd/system/v2ray.service:7: Special user nobody configured, this is not safe!
Mar 11 11:35:07 rog v2ray[2014813]: 2021/03/11 11:35:07 [Warning] failed to handler mux client connection > github.com/v2fly/v2ray-core/v4/proxy/vmess/outbound: failed to find an
 available destination > github.com/v2fly/v2ray-core/v4/common/retry: [github.com/v2fly/v2ray-core/v4/transport/internet/http: failed to dial to tcp:us.lijinglin.dev:443 > Put "h
ttps://us.lijinglin.dev:443/fbb768fc-1e88-4651-936a-8c2b0a499352": dial tcp: operation was canceled] > github.com/v2fly/v2ray-core/v4/common/retry: all retry attempts failed
Mar 11 11:35:11 rog v2ray[2014813]: 2021/03/11 11:35:11 [Warning] failed to handler mux client connection > github.com/v2fly/v2ray-core/v4/proxy/vmess/outbound: failed to find an
 available destination > github.com/v2fly/v2ray-core/v4/common/retry: [github.com/v2fly/v2ray-core/v4/transport/internet/http: failed to dial to tcp:us.lijinglin.dev:443 > Put "h
ttps://us.lijinglin.dev:443/fbb768fc-1e88-4651-936a-8c2b0a499352": dial tcp: operation was canceled] > github.com/v2fly/v2ray-core/v4/common/retry: all retry attempts failed
Mar 11 11:35:15 rog v2ray[2014813]: 2021/03/11 11:35:15 [Warning] failed to handler mux client connection > github.com/v2fly/v2ray-core/v4/proxy/vmess/outbound: failed to find an
 available destination > github.com/v2fly/v2ray-core/v4/common/retry: [github.com/v2fly/v2ray-core/v4/transport/internet/http: failed to dial to tcp:us.lijinglin.dev:443 > Put "h
ttps://us.lijinglin.dev:443/fbb768fc-1e88-4651-936a-8c2b0a499352": dial tcp: operation was canceled] > github.com/v2fly/v2ray-core/v4/common/retry: all retry attempts failed
Mar 11 11:35:19 rog v2ray[2014813]: 2021/03/11 11:35:19 [Warning] failed to handler mux client connection > github.com/v2fly/v2ray-core/v4/proxy/vmess/outbound: failed to find an
 available destination > github.com/v2fly/v2ray-core/v4/common/retry: [github.com/v2fly/v2ray-core/v4/transport/internet/http: failed to dial to tcp:us.lijinglin.dev:443 > Put "h
ttps://us.lijinglin.dev:443/fbb768fc-1e88-4651-936a-8c2b0a499352": dial tcp: operation was canceled] > github.com/v2fly/v2ray-core/v4/common/retry: all retry attempts failed
Mar 11 11:35:23 rog v2ray[2014813]: 2021/03/11 11:35:23 [Warning] failed to handler mux client connection > github.com/v2fly/v2ray-core/v4/proxy/vmess/outbound: failed to find an
 available destination > github.com/v2fly/v2ray-core/v4/common/retry: [github.com/v2fly/v2ray-core/v4/transport/internet/http: failed to dial to tcp:us.lijinglin.dev:443 > Put "h
ttps://us.lijinglin.dev:443/fbb768fc-1e88-4651-936a-8c2b0a499352": dial tcp: operation was canceled] > github.com/v2fly/v2ray-core/v4/common/retry: all retry attempts failed
Mar 11 11:35:27 rog v2ray[2014813]: 2021/03/11 11:35:27 [Warning] failed to handler mux client connection > github.com/v2fly/v2ray-core/v4/proxy/vmess/outbound: failed to find an
 available destination > github.com/v2fly/v2ray-core/v4/common/retry: [github.com/v2fly/v2ray-core/v4/transport/internet/http: failed to dial to tcp:us.lijinglin.dev:443 > Put "h
ttps://us.lijinglin.dev:443/fbb768fc-1e88-4651-936a-8c2b0a499352": dial tcp: operation was canceled] > github.com/v2fly/v2ray-core/v4/common/retry: all retry attempts failed
Mar 11 11:35:31 rog v2ray[2014813]: 2021/03/11 11:35:31 [Warning] failed to handler mux client connection > github.com/v2fly/v2ray-core/v4/proxy/vmess/outbound: failed to find an
 available destination > github.com/v2fly/v2ray-core/v4/common/retry: [github.com/v2fly/v2ray-core/v4/transport/internet/http: failed to dial to tcp:us.lijinglin.dev:443 > Put "h
ttps://us.lijinglin.dev:443/fbb768fc-1e88-4651-936a-8c2b0a499352": dial tcp: operation was canceled] > github.com/v2fly/v2ray-core/v4/common/retry: all retry attempts failed
Mar 11 11:35:35 rog v2ray[2014813]: 2021/03/11 11:35:35 [Warning] failed to handler mux client connection > github.com/v2fly/v2ray-core/v4/proxy/vmess/outbound: failed to find an
 available destination > github.com/v2fly/v2ray-core/v4/common/retry: [github.com/v2fly/v2ray-core/v4/transport/internet/http: failed to dial to tcp:us.lijinglin.dev:443 > Put "h
ttps://us.lijinglin.dev:443/fbb768fc-1e88-4651-936a-8c2b0a499352": dial tcp: operation was canceled] > github.com/v2fly/v2ray-core/v4/common/retry: all retry attempts failed
Mar 11 11:35:39 rog v2ray[2014813]: 2021/03/11 11:35:39 [Warning] failed to handler mux client connection > github.com/v2fly/v2ray-core/v4/proxy/vmess/outbound: failed to find an
 available destination > github.com/v2fly/v2ray-core/v4/common/retry: [github.com/v2fly/v2ray-core/v4/transport/internet/http: failed to dial to tcp:us.lijinglin.dev:443 > Put "h
ttps://us.lijinglin.dev:443/fbb768fc-1e88-4651-936a-8c2b0a499352": dial tcp: operation was canceled] > github.com/v2fly/v2ray-core/v4/common/retry: all retry attempts failed
Mar 11 11:35:41 rog v2ray[2014813]: 2021/03/11 11:35:41 [Warning] failed to handler mux client connection > github.com/v2fly/v2ray-core/v4/proxy/vmess/outbound: failed to find an
 available destination > github.com/v2fly/v2ray-core/v4/common/retry: [github.com/v2fly/v2ray-core/v4/transport/internet/http: failed to dial to tcp:us.lijinglin.dev:443 > Put "h
ttps://us.lijinglin.dev:443/fbb768fc-1e88-4651-936a-8c2b0a499352": dial tcp: operation was canceled] > github.com/v2fly/v2ray-core/v4/common/retry: all retry attempts failed
Mar 11 11:35:45 rog v2ray[2014813]: 2021/03/11 11:35:45 [Warning] failed to handler mux client connection > github.com/v2fly/v2ray-core/v4/proxy/vmess/outbound: failed to find an
 available destination > github.com/v2fly/v2ray-core/v4/common/retry: [github.com/v2fly/v2ray-core/v4/transport/internet/http: failed to dial to tcp:us.lijinglin.dev:443 > Put "h
ttps://us.lijinglin.dev:443/fbb768fc-1e88-4651-936a-8c2b0a499352": dial tcp: operation was canceled] > github.com/v2fly/v2ray-core/v4/common/retry: all retry attempts failed
Mar 11 11:35:49 rog v2ray[2014813]: 2021/03/11 11:35:49 [Warning] failed to handler mux client connection > github.com/v2fly/v2ray-core/v4/proxy/vmess/outbound: failed to find an
 available destination > github.com/v2fly/v2ray-core/v4/common/retry: [github.com/v2fly/v2ray-core/v4/transport/internet/http: failed to dial to tcp:us.lijinglin.dev:443 > Put "h
ttps://us.lijinglin.dev:443/fbb768fc-1e88-4651-936a-8c2b0a499352": dial tcp: operation was canceled] > github.com/v2fly/v2ray-core/v4/common/retry: all retry attempts failed
Mar 11 11:35:53 rog v2ray[2014813]: 2021/03/11 11:35:53 [Warning] failed to handler mux client connection > github.com/v2fly/v2ray-core/v4/proxy/vmess/outbound: failed to find an
 available destination > github.com/v2fly/v2ray-core/v4/common/retry: [github.com/v2fly/v2ray-core/v4/transport/internet/http: failed to dial to tcp:us.lijinglin.dev:443 > Put "h
ttps://us.lijinglin.dev:443/fbb768fc-1e88-4651-936a-8c2b0a499352": dial tcp: operation was canceled] > github.com/v2fly/v2ray-core/v4/common/retry: all retry attempts failed
Mar 11 12:28:11 rog v2ray[2014813]: 2021/03/11 12:28:11 [Warning] failed to handler mux client connection > github.com/v2fly/v2ray-core/v4/proxy/vmess/outbound: failed to find an
 available destination > github.com/v2fly/v2ray-core/v4/common/retry: [github.com/v2fly/v2ray-core/v4/transport/internet/http: failed to dial to tcp:us.lijinglin.dev:443 > Put "h
ttps://us.lijinglin.dev:443/fbb768fc-1e88-4651-936a-8c2b0a499352": dial tcp: operation was canceled] > github.com/v2fly/v2ray-core/v4/common/retry: all retry attempts failed
Mar 11 12:28:15 rog v2ray[2014813]: 2021/03/11 12:28:15 [Warning] failed to handler mux client connection > github.com/v2fly/v2ray-core/v4/proxy/vmess/outbound: failed to find an
 available destination > github.com/v2fly/v2ray-core/v4/common/retry: [github.com/v2fly/v2ray-core/v4/transport/internet/http: failed to dial to tcp:us.lijinglin.dev:443 > Put "h
ttps://us.lijinglin.dev:443/fbb768fc-1e88-4651-936a-8c2b0a499352": dial tcp: operation was canceled] > github.com/v2fly/v2ray-core/v4/common/retry: all retry attempts failed
Mar 11 12:28:19 rog v2ray[2014813]: 2021/03/11 12:28:19 [Warning] failed to handler mux client connection > github.com/v2fly/v2ray-core/v4/proxy/vmess/outbound: failed to find an
 available destination > github.com/v2fly/v2ray-core/v4/common/retry: [github.com/v2fly/v2ray-core/v4/transport/internet/http: failed to dial to tcp:us.lijinglin.dev:443 > Put "h
ttps://us.lijinglin.dev:443/fbb768fc-1e88-4651-936a-8c2b0a499352": dial tcp: operation was canceled] > github.com/v2fly/v2ray-core/v4/common/retry: all retry attempts failed

请附上访问日志

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

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

caddyfile

xxxxxxxx {
    log {
        output file /var/log/caddy/access.log
    }
    tls {
        protocols tls1.2 tls1.3
        ciphers TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256
        curves x25519
    }
    reverse_proxy /xxxxxxxx 127.0.0.1:1000 {
        header_up Host {host}
        header_up X-Real-IP {remote}
        header_up X-Forwarded-For {remote}
        header_up X-Forwarded-Port {server_port}
        header_up X-Forwarded-Proto "https"
        transport http {
            tls
            tls_insecure_skip_verify
        }
    }
    file_server {
        root /usr/share/caddy
    }
}

xxxxxxxx {
    log {
        output file /var/log/caddy/access.log
    }
    tls {
        protocols tls1.2 tls1.3
        ciphers TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256
        curves x25519
    }
    reverse_proxy /xxxxxxxx 127.0.0.1:1024
    file_server {
        root /usr/share/caddy
    }
}

如果 V2Ray 无法启动,请附上 --test 命令的输出

如果 V2Ray 服务运行异常,请附上 journal 日志

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions