Skip to content

Hysteria2跑了一段时间之后崩溃 #3522

@assidence

Description

@assidence

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

客户端5.37.0
服务端5.35.0

你的使用场景是什么?

代理BT流量

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

客户端、服务端崩溃

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

客户端服务端长期运行

请附上你的配置

服务端配置:

{
  "log": {
    "access": {
      "level": "Info",
	  "type": "None",
      "path": "./access.log"
    },
    "error": {
      "level": "Error",
	  "type": "None",
      "path": "./error.log"
    }
  },
  "inbounds": [
    {
      "listen": "0.0.0.0",
      "port": ###,
      "protocol": "hysteria2",
      "settings": {},
      "streamSettings": {
        "security": "tls",
        "securitySettings": {
          "certificate": [
            {
              "certificate_file": "./certs/fullchain",
              "key_file": "./certs/key",
              "usage": "ENCIPHERMENT"
            }
          ]
        },
        "transport": "hysteria2",
        "transportSettings": {
          "congestion": {
            "type": "bbr"
          },
          "password": "###",
          "use_udp_extension": true
        }
      }
    }
  ],
  "outbounds": [
    {
      "protocol": "freedom"
    }
  ]
}

客户端配置:

{
  "log": {
    "error": {
      "level": "Debug",
      "type": "None"
    },
    "access": {
      "type": "None"
    }
  },
  "outbounds": [
    {
      "protocol": "hysteria2",
      "settings": {
        "server": [
          {
            "address": "###",
            "port": ###
          }
        ]
      },
      "streamSettings": {
        "transport": "hysteria2",
        "transportSettings": {
          "password": "###",
          "congestion": {
            "type": "bbr"
          },
          "use_udp_extension": true
        },
        "security": "tls"
      }
    }
  ],
  "inbounds": [
    {
      "protocol": "socks",
      "settings": {
        "udpEnabled": true,
        "address": "127.0.0.1",
        "packetEncoding": "Packet"
      },
      "port": 1080,
      "listen": "0.0.0.0"
    },
    {
      "protocol": "http",
      "settings": {
      },
      "port": 8080,
      "listen": "0.0.0.0"
    },
    {
      "protocol": "http",
      "settings": {
      },
      "port": 1081,
      "listen": "0.0.0.0"
    }
  ]
}

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

服务器端错误日志:

V2Ray 5.35.0 (V2Fly, a community-driven edition of V2Ray.) Custom (go1.24.4 linux/amd64)
A unified platform for anti-censorship.

panic: send on closed channel

goroutine 9226351 [running]:
github.com/v2fly/v2ray-core/v5/transport/internet/hysteria2.(*HyConn).WritePacket(0xc0014ec870, {0xc001ba2000, 0x274, 0x800}, {{0x19f46a8?, 0xc0016a2674?}, 0x1e78?, 0xc0?})
        github.com/v2fly/v2ray-core/v5/transport/internet/hysteria2/conn.go:61 +0xf8
github.com/v2fly/v2ray-core/v5/proxy/hysteria2.(*PacketWriter).writePacket(...)
        github.com/v2fly/v2ray-core/v5/proxy/hysteria2/protocol.go:134
github.com/v2fly/v2ray-core/v5/proxy/hysteria2.(*PacketWriter).WriteMultiBufferWithMetadata(0xc00141ee10, {0xc000b21ec8, 0x1, 0x4725f9?}, {{0x19f46a8?, 0xc0016a2674?}, 0x51f0?, 0xc0?})
        github.com/v2fly/v2ray-core/v5/proxy/hysteria2/protocol.go:118 +0xc5
github.com/v2fly/v2ray-core/v5/proxy/hysteria2.(*Server).handleUDPPayload.func1({0x19f45c8, 0xc001c4bb80}, 0xc000b21fa0?)
        github.com/v2fly/v2ray-core/v5/proxy/hysteria2/server.go:183 +0x57
github.com/v2fly/v2ray-core/v5/transport/internet/udp.handleInput({0x19f45c8, 0xc001c4bb80}, 0xc002216240?, {{0x19f46a8?, 0xc0016a2674?}, 0xbfa8?, 0xc0?}, 0xc000544690)
        github.com/v2fly/v2ray-core/v5/transport/internet/udp/dispatcher_split.go:119 +0x262
created by github.com/v2fly/v2ray-core/v5/transport/internet/udp.(*Dispatcher).getInboundRay in goroutine 3329645
        github.com/v2fly/v2ray-core/v5/transport/internet/udp/dispatcher_split.go:80 +0x4c5

客户端错误日志:

V2Ray 5.37.0 (V2Fly, a community-driven edition of V2Ray.) Custom (go1.24.4 linux/amd64)
A unified platform for anti-censorship.
panic: connection already exists

goroutine 24187026 [running]:
github.com/apernet/quic-go.(*connMultiplexer).AddConn(0xc000910140, {0x7f57837e24e0?, 0xc001e8d348?})
        github.com/apernet/quic-go@v0.48.2-0.20241104191913-cb103fcecfe7/multiplexer.go:59 +0x165
github.com/apernet/quic-go.(*Transport).init.func1()
        github.com/apernet/quic-go@v0.48.2-0.20241104191913-cb103fcecfe7/transport.go:266 +0x3f0
sync.(*Once).doSlow(0x27207a0?, 0x7f578355bfd8?)
        sync/once.go:78 +0xab
sync.(*Once).Do(...)
        sync/once.go:69
github.com/apernet/quic-go.(*Transport).init(0xc001821c00, 0x5c?)
        github.com/apernet/quic-go@v0.48.2-0.20241104191913-cb103fcecfe7/transport.go:225 +0x3f
github.com/apernet/quic-go.(*Transport).dial(0xc001821c00, {0x1a205c0, 0xc0018f4410}, {0x1a13460, 0xc0025164b0}, {0x0, 0x0}, 0xc003db8000, 0xc0033f4ab0, 0x1)
        github.com/apernet/quic-go@v0.48.2-0.20241104191913-cb103fcecfe7/transport.go:212 +0xa5
github.com/apernet/quic-go.(*Transport).DialEarly(...)
        github.com/apernet/quic-go@v0.48.2-0.20241104191913-cb103fcecfe7/transport.go:204
github.com/apernet/quic-go.DialEarly({0x1a205c0, 0xc0018f4410}, {0x1a2bec0?, 0xc001e8d348?}, {0x1a13460, 0xc0025164b0}, 0xc003db8000, 0xc0033f4ab0)
        github.com/apernet/quic-go@v0.48.2-0.20241104191913-cb103fcecfe7/client.go:95 +0x127
github.com/v2fly/hysteria/core/v2/client.(*clientImpl).connect.func1({0x1a205c0?, 0xc0018f4410?}, {0x0?, 0x10000?}, 0xc001146801?, 0x100c001daff70?)
        github.com/v2fly/hysteria/core/v2@v2.0.0-20250113081444-b0a0747ac7ab/client/client.go:95 +0x4d
github.com/apernet/quic-go/http3.(*Transport).dial(0xc0033f4990, {0x1a205c0, 0xc0018f4410}, {0xc000f00170, 0xc})
        github.com/apernet/quic-go@v0.48.2-0.20241104191913-cb103fcecfe7/http3/transport.go:324 +0x27a
github.com/apernet/quic-go/http3.(*Transport).getClient.func1()
        github.com/apernet/quic-go@v0.48.2-0.20241104191913-cb103fcecfe7/http3/transport.go:261 +0x71
created by github.com/apernet/quic-go/http3.(*Transport).getClient in goroutine 24185035
        github.com/apernet/quic-go@v0.48.2-0.20241104191913-cb103fcecfe7/http3/transport.go:258 +0x292

请附上访问日志

None

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

如果 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