Skip to content

Hysteria2 inbound causes Discord WebRTC/screen share lag in TUN mode, while sing-box Hysteria2 works normally #6039

@ARAMU2728

Description

@ARAMU2728

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

Summary

Discord voice works normally through Xray Hysteria2 inbound, but Discord screen share / video stream has heavy lag and stuttering when the client uses TUN mode.

The same VPS and the same client-side network were tested with sing-box / Hiddify Hysteria2, and Discord screen share worked normally there.

The issue appears only with Xray-core Hysteria2 inbound.

Environment

Server:

  • OS: Ubuntu
  • Panel: 3x-ui
  • Core: Xray-core
  • Xray version: 26.4.25
  • Protocol: Hysteria2 inbound
  • Transport/security: Hysteria2 + TLS + ALPN h3

Client:

  • OS: Windows 11
  • Client: Throne, INCY, Happ, Hiddify
  • Mode where issue happens: TUN mode
  • Application affected: Discord

Observed behavior:

  • Discord voice works normally
  • Discord screen share / video stream has heavy lag and stuttering

Important comparison

The same VPS was tested with Hiddify / sing-box Hysteria2.

Result:

  • sing-box / Hiddify Hysteria2: Discord screen share works normally
  • Xray-core Hysteria2 inbound: Discord screen share lags heavily

So this does not look like a VPS, CPU, RAM, swap, or provider network issue.

Additional clarification

I also tested Hysteria2 in Hiddify Panel when it was using Xray-core for Hysteria2.
In that case, Discord screen share / video stream also had the same lag.

When Hysteria2 was handled by sing-box / Hiddify-core on the same VPS, Discord screen share worked normally.

So the issue seems related specifically to Xray-core Hysteria2 handling, not to 3x-ui itself and not to the VPS.

The lag is visible on the viewer side: other Discord users who watch my screen share see heavy stuttering / lag.
Discord voice stays normal at the same time.

I like Xray-core and would prefer to continue using it.
I am reporting this because I would like Hysteria2 in Xray-core to work reliably for Discord screen sharing / video streaming, the same way it works with sing-box Hysteria2 in my tests.

Reproduction Method

  1. Create a Hysteria2 inbound in Xray-core / 3x-ui with TLS and ALPN h3.

  2. Connect from a Windows 11 client using Throne, INCY, Happ, Hiddify

  3. Enable TUN mode in the client.

  4. Route Discord traffic through the Hysteria2 outbound.

  5. Join a Discord voice channel.

  6. Start Discord screen share or video stream.

  7. Observe the result:

    • voice works normally
    • screen share / video stream has heavy lag and stuttering
  8. Repeat the same test on the same VPS with sing-box / Hiddify Hysteria2.

  9. Observe the comparison:

    • sing-box / Hiddify Hysteria2 works normally
    • Xray-core Hysteria2 inbound lags with Discord screen share

Client config

Details

Primary client: Throne on Windows 11
Core process: ThroneCore
Core command line:
C:\Users\PC-User\AppData\Roaming\Throne\ThroneCore -port 7514

Mode where the issue is clearly reproduced: TUN mode
Outbound used for affected Discord traffic: hysteria2

The full internal Throne client config is generated by the GUI and stored internally.
I could not export the full generated config from the Throne UI.

However, the Throne client log confirms that Discord UDP/WebRTC traffic is routed through hysteria2 in TUN mode:

Discord.exe -> outbound/hysteria2[proxy] -> 104.29.147.43:19307
Discord.exe -> outbound/hysteria2[proxy] -> 104.29.147.151:19337
Discord.exe -> outbound/hysteria2[proxy] -> 162.159.137.232:443

Additional clients were also tested:

  • INCY
  • Happ
  • Hiddify

The same Discord screen share / video lag was observed with Xray-core Hysteria2 inbound.

Important comparison:
When using sing-box / Hiddify Hysteria2 on the same VPS, Discord screen share works normally.

In System Proxy mode the screen share does not lag, but this is likely because Discord real-time UDP/WebRTC traffic can bypass the system proxy.

Server config

Details
{
  "log": {
    "access": "none",
    "dnsLog": false,
    "error": "",
    "loglevel": "warning",
    "maskAddress": ""
  },
  "routing": {
    "domainStrategy": "AsIs",
    "rules": [
      {
        "type": "field",
        "inboundTag": [
          "api"
        ],
        "outboundTag": "api"
      },
      {
        "type": "field",
        "outboundTag": "blocked",
        "ip": [
          "geoip:private"
        ]
      },
      {
        "type": "field",
        "outboundTag": "blocked",
        "protocol": [
          "bittorrent"
        ]
      }
    ]
  },
  "dns": null,
  "inbounds": [
    {
      "listen": "127.0.0.1",
      "port": 62789,
      "protocol": "tunnel",
      "settings": {
        "address": "127.0.0.1"
      },
      "streamSettings": null,
      "tag": "api",
      "sniffing": null
    },
    {
      "listen": "0.0.0.0",
      "port": 44572,
      "protocol": "hysteria",
      "settings": {
        "clients": [
          {
            "auth": "redacted",
            "email": "redacted"
          }
        ],
        "version": 2
      },
      "streamSettings": {
        "hysteriaSettings": {
          "auth": "",
          "udpIdleTimeout": 60,
          "version": 2
        },
        "network": "hysteria",
        "security": "tls",
        "tlsSettings": {
          "alpn": [
            "h3"
          ],
          "certificates": [
            {
              "buildChain": false,
              "certificateFile": "/root/cert/ip/fullchain.pem",
              "keyFile": "/root/cert/ip/privkey.pem",
              "oneTimeLoading": false,
              "usage": "encipherment"
            }
          ],
          "cipherSuites": "",
          "disableSystemRoot": false,
          "echForceQuery": "none",
          "echServerKeys": "",
          "enableSessionResumption": false,
          "maxVersion": "1.3",
          "minVersion": "1.2",
          "rejectUnknownSni": false,
          "serverName": ""
        }
      },
      "tag": "inbound-44572",
      "sniffing": {
        "enabled": false,
        "destOverride": [
          "http",
          "tls",
          "quic",
          "fakedns"
        ],
        "metadataOnly": false,
        "routeOnly": false
      }
    }
  ],
  "outbounds": [
    {
      "tag": "direct",
      "protocol": "freedom",
      "settings": {
        "domainStrategy": "AsIs",
        "redirect": "",
        "noises": []
      }
    },
    {
      "tag": "blocked",
      "protocol": "blackhole",
      "settings": {}
    }
  ],
  "transport": null,
  "policy": {
    "levels": {
      "0": {
        "statsUserDownlink": true,
        "statsUserUplink": true
      }
    },
    "system": {
      "statsInboundDownlink": true,
      "statsInboundUplink": true,
      "statsOutboundDownlink": false,
      "statsOutboundUplink": false
    }
  },
  "api": {
    "tag": "api",
    "services": [
      "HandlerService",
      "LoggerService",
      "StatsService"
    ]
  },
  "stats": {},
  "reverse": null,
  "fakedns": null,
  "observatory": null,
  "burstObservatory": null,
  "metrics": {
    "tag": "metrics_out",
    "listen": "127.0.0.1:11111"
  }
}

Client log

Details

INFO[0003] outbound/hysteria2[proxy]: outbound packet connection to 104.29.147.43:19307
INFO[0008] router: found process path: C:\Users\PC-User\AppData\Local\Discord\app-1.0.9234\Discord.exe
INFO[0008] outbound/hysteria2[proxy]: outbound connection to 162.159.137.232:443
INFO[0011] router: found process path: C:\Users\PC-User\AppData\Local\Discord\app-1.0.9234\Discord.exe
INFO[0011] outbound/hysteria2[proxy]: outbound packet connection to 104.29.147.43:19307
INFO[0058] router: found process path: C:\Users\PC-User\AppData\Local\Discord\app-1.0.9234\Discord.exe
INFO[0058] outbound/hysteria2[proxy]: outbound packet connection to 104.29.147.151:19337

Server log

Details

This is the available x-ui journal output containing Xray-core messages. I could not obtain a separate Xray-core debug log from 3x-ui.

Xray starts successfully:

Apr 29 18:16:36 ubuntu /usr/local/x-ui/x-ui[42838]: INFO - XRAY: infra/conf/serial: Reading config: &{Name:bin/config.json Format:json}
Apr 29 18:16:36 ubuntu /usr/local/x-ui/x-ui[42838]: WARNING - XRAY: core: Xray 26.4.25 started

No runtime Xray errors were shown during the Discord screen share lag.

Older unrelated startup errors were caused by temporary test configurations:

  • BrutalUp must be at least 65536 bytes per second
  • failed to parse certificate / both file and bytes are empty

These errors were fixed before the actual Discord screen share test.

During the lag:

  • Xray was running
  • UDP kernel error counters did not increase
  • UDP socket queue did not grow
  • no interface drops
  • no fq_codel drops
  • CPU/RAM were not exhausted

Metadata

Metadata

Assignees

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