XHTTP/3 inbound: the default of 100 QUIC streams per connection stalls packet-up uploads

Abierto Apto para principiantes
#7,397 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

  • #7440 de @earmark-halt — cerrado sin fusionar

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
62/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
go, python
Área
networking

Línea de trabajo

El límite predeterminado de streams se pasa a quic-go en transport/internet/splithttp/hub.go, alrededor de la línea 494, donde quicParams.maxIncomingStreams se copia en la configuración de QUIC. Empieza ahí y luego ejecuta el script de Python del issue contra las configuraciones del cliente y del servidor para reproducir el bloqueo en la sesión 100. Se considera terminado cuando packet-up sobre h3 sigue respondiendo después de 100 sesiones y el cambio se verifica con los casos stream-one y h2 de la tabla del issue.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Integrity requirements
  • I have read all the comments in the issue template and ensured that this issue meet the requirements.
  • I confirm that I have read the documentation, understand the meaning of all the configuration items I wrote, and did not pile up seemingly useful options or default values.
  • I provided the complete config and logs, rather than just providing the truncated parts based on my own judgment.
  • I searched issues and did not find any similar issues.
  • The problem can be successfully reproduced in the latest Release
Description

An XHTTP/3 inbound passes quicParams.maxIncomingStreams to quic-go unchanged (transport/internet/splithttp/hub.go:494 on main). When it is not set, quic-go's default applies: 100 bidirectional streams per connection.

Every XHTTP session keeps one stream open for its whole life, and in packet-up each upload request needs one more. Once a QUIC connection carries 100 sessions, no session on it can upload any more, including the ones that had been working. In stream-one the existing sessions keep working and only new ones wait.

Results with the official v26.11.9 binary, loopback, using the configs below. The client is limited to one connection (xmux.maxConnections: 1) only to keep the test small:

Case Result
packet-up over h3 session 100 gets no reply; sessions 1, 2 and 50, opened earlier, get no reply when they send again
stream-one over h3 (same configs, mode changed) session 101 gets no reply; sessions 1, 2 and 50 still get replies
packet-up over h2 (same configs, ALPN changed) all 110 sessions get replies
packet-up over h3, server with finalmask.quicParams.maxIncomingStreams: 4096 all 110 sessions get replies

With the client's default XMUX settings (no xmux in the config, so 3 connections), tested on main at c4561418: sessions that send one request and then stay open reached the first failure at session 254, 259 and 289 in three runs, and 99 sessions that had been working could no longer upload. Sessions that each sent 12 requests before going idle did not reach it within 700 sessions, because the client retires a connection after 600 to 900 requests.

HTTP/2 inbounds are not affected: at the server's stream limit the client opens another TCP connection.

A possible fix is a large default when the value is not set. With this change on main, 400 sessions with default client settings all kept working:

--- a/transport/internet/splithttp/hub.go
+++ b/transport/internet/splithttp/hub.go
@@ -495,6 +495,12 @@
 			DisablePathMTUDiscovery:        quicParams.DisablePathMtuDiscovery || (runtime.GOOS != "linux" && runtime.GOOS != "windows" && runtime.GOOS != "darwin"),
 		}
 
+		if quicConfig.MaxIncomingStreams == 0 {
+			// quic-go's default of 100 is per connection, and every session holds one stream for its
+			// whole lifetime, while packet-up needs one more stream for each upload request.
+			quicConfig.MaxIncomingStreams = 1 << 16
+		}
+
 		var k *quic.StatelessResetKey
 		if !quicParams.DisableStatelessReset {
 			k = &quic.StatelessResetKey{}

Prepared with the assistance of Claude (Anthropic). Every result above comes from a run described here.

Reproduction Method
  1. Start the server and the client with the configs below (official v26.11.9 Xray-linux-64).
  2. Run this script. It starts an echo server on 127.0.0.1:9002, opens connections one by one through the client's dokodemo-door inbound, sends ping on each and keeps them all open.
import socket, threading

def echo_server():
    s = socket.create_server(("127.0.0.1", 9002))
    while True:
        c, _ = s.accept()
        threading.Thread(target=lambda c=c: [c.sendall(d) for d in iter(lambda: c.recv(65536), b"")], daemon=True).start()

def ping(c, timeout):
    c.settimeout(timeout)
    c.sendall(b"ping")
    try:
        return c.recv(4) == b"ping"
    except socket.timeout:
        return False

threading.Thread(target=echo_server, daemon=True).start()
conns = []
for i in range(1, 111):
    c = socket.create_connection(("127.0.0.1", 7002))  # dokodemo-door -> VLESS + XHTTP/3 -> echo
    conns.append(c)
    if not ping(c, 5):
        print("session", i, "got no reply")
        break
else:
    print("all", len(conns), "sessions got a reply")
for i in (1, 2, 50):
    if i < len(conns):
        print("session", i, "opened earlier, sends again:", "reply" if ping(conns[i - 1], 5) else "no reply")

Output with the configs below:

session 100 got no reply
session 1 opened earlier, sends again: no reply
session 2 opened earlier, sends again: no reply
session 50 opened earlier, sends again: no reply
Client config

{
  "log": {
    "loglevel": "debug",
    "dnsLog": true
  },
  "inbounds": [
    {
      "listen": "127.0.0.1",
      "port": 7002,
      "protocol": "dokodemo-door",
      "settings": {
        "address": "127.0.0.1",
        "port": 9002,
        "network": "tcp"
      }
    }
  ],
  "outbounds": [
    {
      "protocol": "vless",
      "settings": {
        "vnext": [
          {
            "address": "127.0.0.1",
            "port": 8443,
            "users": [
              {
                "id": "5783a3e7-e373-51cd-8642-c83782b807c5",
                "encryption": "none"
              }
            ]
          }
        ]
      },
      "streamSettings": {
        "network": "xhttp",
        "security": "tls",
        "tlsSettings": {
          "serverName": "localhost",
          "alpn": [
            "h3"
          ],
          "pinnedPeerCertSha256": "e08ee1e68bad3a9a890e931e6f25e6e1bd11e4de376e1d5742fa4173abb523ff"
        },
        "xhttpSettings": {
          "path": "/xh",
          "mode": "packet-up",
          "xmux": {
            "maxConnections": 1
          }
        }
      }
    }
  ]
}
Server config

{
  "log": {
    "loglevel": "debug",
    "dnsLog": true
  },
  "inbounds": [
    {
      "listen": "127.0.0.1",
      "port": 8443,
      "protocol": "vless",
      "settings": {
        "clients": [
          {
            "id": "5783a3e7-e373-51cd-8642-c83782b807c5"
          }
        ],
        "decryption": "none"
      },
      "streamSettings": {
        "network": "xhttp",
        "security": "tls",
        "tlsSettings": {
          "alpn": [
            "h3"
          ],
          "certificates": [
            {
              "certificate": [
                "-----BEGIN CERTIFICATE-----",
                "MIIBkjCCATmgAwIBAgIUAr1AxAZbm4w0Z+7hV+BMWcHqcU4wCgYIKoZIzj0EAwIw",
                "FDESMBAGA1UEAwwJbG9jYWxob3N0MB4XDTI2MTExNDA0MzIxMFoXDTI2MTIxNDA0",
                "MzIxMFowFDESMBAGA1UEAwwJbG9jYWxob3N0MFkwEwYHKoZIzj0CAQYIKoZIzj0D",
                "AQcDQgAEd2A6GRamf2wRCSilQRnvjCSqQfTXefCZsMdwzAdYXqjNEQLmh6w941n+",
                "chw3bYap74dnhnuP1i8VPIjxSVPSI6NpMGcwHQYDVR0OBBYEFE9Viai2yha2ZF5p",
                "qlBsBDLG/TKtMB8GA1UdIwQYMBaAFE9Viai2yha2ZF5pqlBsBDLG/TKtMA8GA1Ud",
                "EwEB/wQFMAMBAf8wFAYDVR0RBA0wC4IJbG9jYWxob3N0MAoGCCqGSM49BAMCA0cA",
                "MEQCIAplgNqNVOL6waUhuh4CIOkOKuGFqRgrq1cVnecnaUStAiBDgPQ4r+Y6sgLS",
                "4IWoyNqH4q9iojDNugxURCOQrpblzQ==",
                "-----END CERTIFICATE-----"
              ],
              "key": [
                "-----BEGIN PRIVATE KEY-----",
                "MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgs+4kfGaYz+7ooJkf",
                "e83tzmgE23XWNrWQxYPmpsgXqeihRANCAAR3YDoZFqZ/bBEJKKVBGe+MJKpB9Nd5",
                "8Jmwx3DMB1heqM0RAuaHrD3jWf5yHDdthqnvh2eGe4/WLxU8iPFJU9Ij",
                "-----END PRIVATE KEY-----"
              ]
            }
          ]
        },
        "xhttpSettings": {
          "path": "/xh"
        }
      }
    }
  ],
  "outbounds": [
    {
      "protocol": "freedom",
      "settings": {
        "finalRules": [
          {
            "action": "allow"
          }
        ]
      }
    }
  ]
}
Client log

The complete debug logs of this run are 68 KB (client) and 81 KB (server), more than an issue can hold, so they are here unmodified: https://gist.github.com/AlenHay/93571c075379b2da6a7b5360af61d089

The last 30 lines of the client log:


2026/11/14 05:32:22.071509 from 127.0.0.1:45488 accepted tcp:127.0.0.1:9002
2026/11/14 05:32:22.071514 [Info] [1058731554] proxy/dokodemo: received request for 127.0.0.1:45488
2026/11/14 05:32:22.071517 [Info] [1058731554] app/dispatcher: default route for tcp:127.0.0.1:9002
2026/11/14 05:32:22.071519 [Info] [1058731554] transport/internet/splithttp: XHTTP is dialing to udp:127.0.0.1:8443, mode packet-up, HTTP version 3, host localhost
2026/11/14 05:32:22.071522 [Info] [1058731554] proxy/vless/outbound: tunneling request to tcp:127.0.0.1:9002 via 127.0.0.1:8443
2026/11/14 05:32:22.072193 [Debug] [1724932045] proxy/dokodemo: processing connection from: 127.0.0.1:45498
2026/11/14 05:32:22.072198 [Info] [1724932045] proxy/dokodemo: received request for 127.0.0.1:45498
2026/11/14 05:32:22.072201 [Info] [1724932045] app/dispatcher: default route for tcp:127.0.0.1:9002
2026/11/14 05:32:22.072203 [Info] [1724932045] transport/internet/splithttp: XHTTP is dialing to udp:127.0.0.1:8443, mode packet-up, HTTP version 3, host localhost
2026/11/14 05:32:22.072206 [Info] [1724932045] proxy/vless/outbound: tunneling request to tcp:127.0.0.1:9002 via 127.0.0.1:8443
2026/11/14 05:32:22.072208 from 127.0.0.1:45498 accepted tcp:127.0.0.1:9002
2026/11/14 05:32:22.073731 from 127.0.0.1:45508 accepted tcp:127.0.0.1:9002
2026/11/14 05:32:22.073744 [Debug] [4048388148] proxy/dokodemo: processing connection from: 127.0.0.1:45508
2026/11/14 05:32:22.073748 [Info] [4048388148] proxy/dokodemo: received request for 127.0.0.1:45508
2026/11/14 05:32:22.073750 [Info] [4048388148] app/dispatcher: default route for tcp:127.0.0.1:9002
2026/11/14 05:32:22.073753 [Info] [4048388148] transport/internet/splithttp: XHTTP is dialing to udp:127.0.0.1:8443, mode packet-up, HTTP version 3, host localhost
2026/11/14 05:32:22.073756 [Info] [4048388148] proxy/vless/outbound: tunneling request to tcp:127.0.0.1:9002 via 127.0.0.1:8443
2026/11/14 05:32:22.075483 [Debug] [426136640] proxy/dokodemo: processing connection from: 127.0.0.1:45514
2026/11/14 05:32:22.075490 from 127.0.0.1:45514 accepted tcp:127.0.0.1:9002
2026/11/14 05:32:22.075494 [Info] [426136640] proxy/dokodemo: received request for 127.0.0.1:45514
2026/11/14 05:32:22.075502 [Info] [426136640] app/dispatcher: default route for tcp:127.0.0.1:9002
2026/11/14 05:32:22.075509 [Info] [426136640] transport/internet/splithttp: XHTTP is dialing to udp:127.0.0.1:8443, mode packet-up, HTTP version 3, host localhost
2026/11/14 05:32:22.075564 [Info] [426136640] proxy/vless/outbound: tunneling request to tcp:127.0.0.1:9002 via 127.0.0.1:8443
2026/11/14 05:32:22.076449 from 127.0.0.1:45526 accepted tcp:127.0.0.1:9002
2026/11/14 05:32:22.076462 [Debug] [149318371] proxy/dokodemo: processing connection from: 127.0.0.1:45526
2026/11/14 05:32:22.076466 [Info] [149318371] proxy/dokodemo: received request for 127.0.0.1:45526
2026/11/14 05:32:22.076469 [Info] [149318371] app/dispatcher: default route for tcp:127.0.0.1:9002
2026/11/14 05:32:22.076471 [Info] [149318371] transport/internet/splithttp: XHTTP is dialing to udp:127.0.0.1:8443, mode packet-up, HTTP version 3, host localhost
2026/11/14 05:32:22.076474 [Info] [149318371] proxy/vless/outbound: tunneling request to tcp:127.0.0.1:9002 via 127.0.0.1:8443
2026/11/14 05:32:42.103203 [Debug] app/log: Logger closing
Server log

Complete log: https://gist.github.com/AlenHay/93571c075379b2da6a7b5360af61d089

The last 30 lines of the server log:


2026/11/14 05:32:22.071796 [Info] [2917082436] transport/internet/tcp: dialing TCP to tcp:127.0.0.1:9002
2026/11/14 05:32:22.071797 [Debug] [2917082436] transport/internet: dialing to tcp:127.0.0.1:9002
2026/11/14 05:32:22.071800 from 127.0.0.1:59948 accepted tcp:127.0.0.1:9002
2026/11/14 05:32:22.071860 [Info] [2917082436] proxy/freedom: connection opened to tcp:127.0.0.1:9002, local endpoint 127.0.0.1:34752, remote endpoint 127.0.0.1:9002
2026/11/14 05:32:22.071869 [Debug] [2917082436] proxy: CopyRawConn (maybe) readv
2026/11/14 05:32:22.073169 [Info] [3947852290] proxy/vless/inbound: firstLen = 30
2026/11/14 05:32:22.073182 [Info] [3947852290] proxy/vless/inbound: received request for tcp:127.0.0.1:9002
2026/11/14 05:32:22.073185 [Info] [3947852290] app/dispatcher: default route for tcp:127.0.0.1:9002
2026/11/14 05:32:22.073188 [Info] [3947852290] transport/internet/tcp: dialing TCP to tcp:127.0.0.1:9002
2026/11/14 05:32:22.073190 [Debug] [3947852290] transport/internet: dialing to tcp:127.0.0.1:9002
2026/11/14 05:32:22.073206 from 127.0.0.1:59948 accepted tcp:127.0.0.1:9002
2026/11/14 05:32:22.073316 [Info] [3947852290] proxy/freedom: connection opened to tcp:127.0.0.1:9002, local endpoint 127.0.0.1:34766, remote endpoint 127.0.0.1:9002
2026/11/14 05:32:22.073320 [Debug] [3947852290] proxy: CopyRawConn (maybe) readv
2026/11/14 05:32:22.074474 from 127.0.0.1:59948 accepted tcp:127.0.0.1:9002
2026/11/14 05:32:22.074665 [Info] [4053786092] proxy/vless/inbound: firstLen = 30
2026/11/14 05:32:22.074702 [Info] [4053786092] proxy/vless/inbound: received request for tcp:127.0.0.1:9002
2026/11/14 05:32:22.074707 [Info] [4053786092] app/dispatcher: default route for tcp:127.0.0.1:9002
2026/11/14 05:32:22.074711 [Info] [4053786092] transport/internet/tcp: dialing TCP to tcp:127.0.0.1:9002
2026/11/14 05:32:22.074715 [Debug] [4053786092] transport/internet: dialing to tcp:127.0.0.1:9002
2026/11/14 05:32:22.074720 [Info] [4053786092] proxy/freedom: connection opened to tcp:127.0.0.1:9002, local endpoint 127.0.0.1:34782, remote endpoint 127.0.0.1:9002
2026/11/14 05:32:22.074724 [Debug] [4053786092] proxy: CopyRawConn (maybe) readv
2026/11/14 05:32:22.075897 [Info] [184499830] proxy/vless/inbound: firstLen = 30
2026/11/14 05:32:22.075904 [Info] [184499830] proxy/vless/inbound: received request for tcp:127.0.0.1:9002
2026/11/14 05:32:22.075904 from 127.0.0.1:59948 accepted tcp:127.0.0.1:9002
2026/11/14 05:32:22.075907 [Info] [184499830] app/dispatcher: default route for tcp:127.0.0.1:9002
2026/11/14 05:32:22.075915 [Info] [184499830] transport/internet/tcp: dialing TCP to tcp:127.0.0.1:9002
2026/11/14 05:32:22.075919 [Debug] [184499830] transport/internet: dialing to tcp:127.0.0.1:9002
2026/11/14 05:32:22.075975 [Info] [184499830] proxy/freedom: connection opened to tcp:127.0.0.1:9002, local endpoint 127.0.0.1:34792, remote endpoint 127.0.0.1:9002
2026/11/14 05:32:22.075980 [Debug] [184499830] proxy: CopyRawConn (maybe) readv
2026/11/14 05:32:42.103206 [Debug] app/log: Logger closing
Lenguaje dominante
Go
Estrellas
43.3k
Forks
6.2k
Merge medio
2 d 11 h
PR fusionados (30 d)
55

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de XTLS/Xray-core

Todos los issues de XTLS/Xray-core

Issues similares

Más issues de Go

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.