Skip to content

xhttp (H3/QUIC) 入站通过 API rmi 移除后,UDP 端口未释放,仍在监听直到重启进程。其他方式没有这个问题 #6598

Closed

Description

@fscarmen

完整性要求

  • 我读完了 issue 模板中的所有注释,确保填写符合要求。
  • 我保证阅读了文档,了解所有我编写的配置文件项的含义,而不是大量堆砌看似有用的选项或默认值。
  • 我提供了完整的配置文件和日志,而不是出于自己的判断只给出截取的部分。
  • 我搜索了 issues, 没有发现已提出的类似问题。
  • 问题在 Release 最新的版本上可以成功复现

描述

环境

  • Xray-core 版本:26.7.28
  • 系统:Ubuntu 20.04.6 LTS (amd64),root 用户,systemd 运行

问题

通过 Xray API rmi 移除使用 H3/QUIC 的 xhttp 入站时,入站 tag 会被移除,但底层 UDP socket 没有关闭,旧端口继续被 xray 进程占用并持续接受流量,只能重启整个进程才能释放。同一环境下,hysteria2(同样是 UDP/QUIC)和所有 TCP 入站都能被 rmi 正常释放。

重现方式

# 通过 api 查原来所有的入站
root@7391638636hax:~# /etc/argox/xray api lsi --server=127.0.0.1:21280 | jq -r '.inbounds[] | "\(.tag) \(.receiverSettings.portList)"'
🇺🇸 7391638636hax.localdomain hysteria2 3535
🇺🇸 7391638636hax.localdomain reality-grpc 6547
🇺🇸 7391638636hax.localdomain vmess-ws 23333
🇺🇸 7391638636hax.localdomain trojan-ws 1246
🇺🇸 7391638636hax.localdomain xhttp-h2-reality 134
🇺🇸 7391638636hax.localdomain ss2022-direct 30011
🇺🇸 7391638636hax.localdomain reality-vision 30000
🇺🇸 7391638636hax.localdomain vless-ws 2346
🇺🇸 7391638636hax.localdomain ss-ws 1563
🇺🇸 7391638636hax.localdomain xhttp-h1.1-cdn 6456
🇺🇸 7391638636hax.localdomain xhttp-h3-direct 33333
🇺🇸 7391638636hax.localdomain trojan-direct 6922

# 配置文件
root@7391638636hax:~# cat /tmp/argox/test_xh3.json 
{"inbounds":[{"tag":"test-xh3","port":23456,"protocol":"vless","settings":{"clients":[{"id":"c15733b0-2866-4c57-82de-adabc55deb9e"}],"decryption":"none"},"streamSettings":{"network":"xhttp","security":"tls","xhttpSettings":{"mode":"stream-up","extra":{"alpn":["h3"]},"path":"/argox-xh3"},"tlsSettings":{"serverName":"addons.mozilla.org","alpn":["h3"],"certificates":[{"certificateFile":"/etc/argox/cert/cert.pem","keyFile":"/etc/argox/cert/private.key"}]}},"sniffing":{"enabled":true,"destOverride":["http","tls","quic"]}}]}

# 通过 api 添加入站
/etc/argox/xray api adi --server=127.0.0.1:21280 /tmp/argox/test_xh3.json
adding: test-xh3
{}

# 查看端口,入站已经添加成功了
root@7391638636hax:~# ss -nltup | grep 23456
udp     UNCONN   0        0                      *:23456                *:*      users:(("xray",pid=272001,fd=36))  

# 通过 api 查刚才添加端口为23456的入站也查到了
root@7391638636hax:~# /etc/argox/xray api lsi --server=127.0.0.1:21280 | jq -r '.inbounds[] | "\(.tag) \(.receiverSettings.portList)"'
test-xh3 23456
🇺🇸 7391638636hax.localdomain hysteria2 3535
🇺🇸 7391638636hax.localdomain reality-grpc 6547
🇺🇸 7391638636hax.localdomain vmess-ws 23333
🇺🇸 7391638636hax.localdomain trojan-ws 1246
🇺🇸 7391638636hax.localdomain xhttp-h2-reality 134
🇺🇸 7391638636hax.localdomain ss2022-direct 30011
🇺🇸 7391638636hax.localdomain reality-vision 30000
🇺🇸 7391638636hax.localdomain vless-ws 2346
🇺🇸 7391638636hax.localdomain ss-ws 1563
🇺🇸 7391638636hax.localdomain xhttp-h1.1-cdn 6456
🇺🇸 7391638636hax.localdomain xhttp-h3-direct 33333
🇺🇸 7391638636hax.localdomain trojan-direct 6922

# 通过 api 删除刚才添加的入站
root@7391638636hax:~# /etc/argox/xray api rmi --server=127.0.0.1:21280 test-xh3
removing inbounds: [test-xh3]
removing: test-xh3
{}

# 再次通过 api 查所有的入站,看到已经没有了23456的入站了
root@7391638636hax:~# /etc/argox/xray api lsi --server=127.0.0.1:21280 | jq -r '.inbounds[] | "\(.tag) \(.receiverSettings.portList)"'
🇺🇸 7391638636hax.localdomain xhttp-h2-reality 134
🇺🇸 7391638636hax.localdomain ss2022-direct 30011
🇺🇸 7391638636hax.localdomain reality-vision 30000
🇺🇸 7391638636hax.localdomain vless-ws 2346
🇺🇸 7391638636hax.localdomain ss-ws 1563
🇺🇸 7391638636hax.localdomain xhttp-h1.1-cdn 6456
🇺🇸 7391638636hax.localdomain xhttp-h3-direct 33333
🇺🇸 7391638636hax.localdomain trojan-direct 6922
🇺🇸 7391638636hax.localdomain hysteria2 3535
🇺🇸 7391638636hax.localdomain reality-grpc 6547
🇺🇸 7391638636hax.localdomain vmess-ws 23333
🇺🇸 7391638636hax.localdomain trojan-ws 1246

# 但再次查看端口仍然存在,没有清空
root@7391638636hax:~# ss -nltup | grep 23456
udp     UNCONN   0        0                      *:23456                *:*      users:(("xray",pid=272001,fd=36)) 

# 重启 xray 进程守护,才能把 UDP 端口释放,查不到端口占用了
root@7391638636hax:~# systemctl restart xray 
root@7391638636hax:~# ss -nltup | grep 23456
root@7391638636hax:~# 

预期

rmi 后 UDP/QUIC socket 立即关闭、端口释放。

实际

socket 仍被 xray 进程持有并继续处理已删除入站的流量,只能重启释放。

补充

  • 同一环境 hysteria2(UDP/QUIC)和 TCP 入站 rmi 后端口都能正常释放,只有 xhttp h3 存在此问题。
  • 实际影响:通过 API 修改 xhttp-h3 端口(rmi + adi)后,新旧端口会同时监听,旧端口静默按旧配置服务,直到重启。
  • 临时规避:修改/删除 xhttp-h3 入站后重启 xray。

客户端配置

null

服务端配置

{
    "api": {
        "tag": "api",
        "listen": "127.0.0.1:21280",
        "services": [
            "HandlerService",
            "LoggerService",
            "StatsService",
            "RoutingService"
        ]
    },
    "stats": {

    },
    "policy": {
        "system": {
            "statsInboundUplink": true,
            "statsInboundDownlink": true,
            "statsOutboundUplink": true,
            "statsOutboundDownlink": true
        }
    },
    "log": {
        "access": "/dev/null",
        "error": "/dev/null",
        "loglevel": "none"
    },
    "inbounds": [
        {
            "tag": "🇺🇸 7391638636hax.localdomain reality-vision",
            "protocol": "vless",
            "port": 30000,
            "settings": {
                "clients": [
                    {
                        "id": "c15733b0-2866-4c57-82de-adabc55deb9e",
                        "flow": "xtls-rprx-vision"
                    }
                ],
                "decryption": "none"
            },
            "streamSettings": {
                "network": "tcp",
                "security": "reality",
                "realitySettings": {
                    "show": false,
                    "minClientVer": "1.0.0",
                    "dest": "addons.mozilla.org:443",
                    "serverNames": [
                        "addons.mozilla.org"
                    ],
                    "privateKey": "KE1Vw9Yzf_5sF_oZXdp-FfbWKGybt0QEf-KJKhZla2c",
                    "publicKey": "z68MK5MCBQm3CNUzgbCHM_H6Sv_ovYd-YU-IgU2q3h8",
                    "shortIds": [
                        ""
                    ]
                }
            },
            "sniffing": {
                "enabled": true,
                "destOverride": [
                    "[http](https://www.json.cn/http)",
                    "tls"
                ]
            }
        },
        {
            "tag": "🇺🇸 7391638636hax.localdomain hysteria2",
            "protocol": "hysteria",
            "port": 3535,
            "settings": {
                "version": 2,
                "clients": [
                    {
                        "auth": "c15733b0-2866-4c57-82de-adabc55deb9e"
                    }
                ]
            },
            "streamSettings": {
                "network": "hysteria",
                "security": "tls",
                "tlsSettings": {
                    "serverNames": [
                        "addons.mozilla.org"
                    ],
                    "alpn": [
                        "h3"
                    ],
                    "certificates": [
                        {
                            "certificateFile": "/etc/argox/cert/cert.pem",
                            "keyFile": "/etc/argox/cert/private.key"
                        }
                    ]
                }
            }
        },
        {
            "tag": "🇺🇸 7391638636hax.localdomain reality-grpc",
            "protocol": "vless",
            "port": 6547,
            "settings": {
                "clients": [
                    {
                        "id": "c15733b0-2866-4c57-82de-adabc55deb9e",
                        "flow": ""
                    }
                ],
                "decryption": "none"
            },
            "streamSettings": {
                "network": "grpc",
                "security": "reality",
                "realitySettings": {
                    "show": false,
                    "minClientVer": "1.0.0",
                    "dest": "addons.mozilla.org:443",
                    "xver": 0,
                    "serverNames": [
                        "addons.mozilla.org"
                    ],
                    "privateKey": "KE1Vw9Yzf_5sF_oZXdp-FfbWKGybt0QEf-KJKhZla2c",
                    "publicKey": "z68MK5MCBQm3CNUzgbCHM_H6Sv_ovYd-YU-IgU2q3h8",
                    "shortIds": [
                        ""
                    ]
                },
                "grpcSettings": {
                    "serviceName": "grpc",
                    "multiMode": true
                }
            },
            "sniffing": {
                "enabled": true,
                "destOverride": [
                    "[http](https://www.json.cn/http)",
                    "tls"
                ]
            }
        },
        {
            "tag": "🇺🇸 7391638636hax.localdomain vless-ws",
            "protocol": "vless",
            "port": 2346,
            "listen": "127.0.0.1",
            "settings": {
                "clients": [
                    {
                        "id": "c15733b0-2866-4c57-82de-adabc55deb9e",
                        "level": 0
                    }
                ],
                "decryption": "none"
            },
            "streamSettings": {
                "network": "ws",
                "security": "none",
                "wsSettings": {
                    "path": "/argox-vl"
                }
            },
            "sniffing": {
                "enabled": true,
                "destOverride": [
                    "[http](https://www.json.cn/http)",
                    "tls",
                    "quic"
                ],
                "metadataOnly": false
            }
        },
        {
            "tag": "🇺🇸 7391638636hax.localdomain vmess-ws",
            "protocol": "vmess",
            "port": 23333,
            "listen": "127.0.0.1",
            "settings": {
                "clients": [
                    {
                        "id": "c15733b0-2866-4c57-82de-adabc55deb9e",
                        "alterId": 0
                    }
                ]
            },
            "streamSettings": {
                "network": "ws",
                "wsSettings": {
                    "path": "/argox-vm"
                }
            },
            "sniffing": {
                "enabled": true,
                "destOverride": [
                    "[http](https://www.json.cn/http)",
                    "tls",
                    "quic"
                ],
                "metadataOnly": false
            }
        },
        {
            "tag": "🇺🇸 7391638636hax.localdomain trojan-ws",
            "protocol": "trojan",
            "port": 1246,
            "listen": "127.0.0.1",
            "settings": {
                "clients": [
                    {
                        "password": "c15733b0-2866-4c57-82de-adabc55deb9e"
                    }
                ]
            },
            "streamSettings": {
                "network": "ws",
                "security": "none",
                "wsSettings": {
                    "path": "/argox-tr"
                }
            },
            "sniffing": {
                "enabled": true,
                "destOverride": [
                    "[http](https://www.json.cn/http)",
                    "tls",
                    "quic"
                ],
                "metadataOnly": false
            }
        },
        {
            "tag": "🇺🇸 7391638636hax.localdomain ss-ws",
            "protocol": "shadowsocks",
            "port": 1563,
            "listen": "127.0.0.1",
            "settings": {
                "clients": [
                    {
                        "method": "chacha20-ietf-poly1305",
                        "password": "c15733b0-2866-4c57-82de-adabc55deb9e"
                    }
                ],
                "network": "tcp,udp"
            },
            "streamSettings": {
                "network": "ws",
                "wsSettings": {
                    "path": "/argox-sh"
                }
            },
            "sniffing": {
                "enabled": true,
                "destOverride": [
                    "[http](https://www.json.cn/http)",
                    "tls",
                    "quic"
                ],
                "metadataOnly": false
            }
        },
        {
            "tag": "🇺🇸 7391638636hax.localdomain xhttp-h1.1-cdn",
            "protocol": "vless",
            "port": 6456,
            "listen": "127.0.0.1",
            "settings": {
                "clients": [
                    {
                        "id": "c15733b0-2866-4c57-82de-adabc55deb9e"
                    }
                ],
                "decryption": "none"
            },
            "streamSettings": {
                "network": "x[http](https://www.json.cn/http)",
                "security": "none",
                "xhttpSettings": {
                    "mode": "auto",
                    "path": "/argox-xh"
                }
            },
            "sniffing": {
                "enabled": true,
                "destOverride": [
                    "http",
                    "tls",
                    "quic"
                ],
                "metadataOnly": false
            }
        },
        {
            "tag": "🇺🇸 7391638636hax.localdomain xhttp-h2-reality",
            "port": 134,
            "protocol": "vless",
            "settings": {
                "clients": [
                    {
                        "id": "c15733b0-2866-4c57-82de-adabc55deb9e",
                        "flow": ""
                    }
                ],
                "decryption": "none"
            },
            "streamSettings": {
                "network": "x[http](https://www.json.cn/http)",
                "xhttpSettings": {
                    "mode": "auto",
                    "path": "/argox-xh2"
                },
                "security": "reality",
                "realitySettings": {
                    "show": false,
                    "minClientVer": "1.0.0",
                    "dest": "addons.mozilla.org:443",
                    "xver": 0,
                    "serverNames": [
                        "addons.mozilla.org"
                    ],
                    "privateKey": "KE1Vw9Yzf_5sF_oZXdp-FfbWKGybt0QEf-KJKhZla2c",
                    "publicKey": "z68MK5MCBQm3CNUzgbCHM_H6Sv_ovYd-YU-IgU2q3h8",
                    "shortIds": [
                        ""
                    ],
                    "alpn": [
                        "h2"
                    ]
                }
            },
            "sniffing": {
                "enabled": true,
                "destOverride": [
                    "[http](https://www.json.cn/http)",
                    "tls",
                    "quic"
                ]
            }
        },
        {
            "tag": "🇺🇸 7391638636hax.localdomain xhttp-h3-direct",
            "port": 33333,
            "protocol": "vless",
            "settings": {
                "clients": [
                    {
                        "id": "c15733b0-2866-4c57-82de-adabc55deb9e"
                    }
                ],
                "decryption": "none"
            },
            "streamSettings": {
                "network": "x[http](https://www.json.cn/http)",
                "security": "tls",
                "xhttpSettings": {
                    "mode": "stream-up",
                    "extra": {
                        "alpn": [
                            "h3"
                        ]
                    },
                    "path": "/argox-xh3"
                },
                "tlsSettings": {
                    "serverName": "addons.mozilla.org",
                    "alpn": [
                        "h3"
                    ],
                    "certificates": [
                        {
                            "certificateFile": "/etc/argox/cert/cert.pem",
                            "keyFile": "/etc/argox/cert/private.key"
                        }
                    ]
                }
            },
            "sniffing": {
                "enabled": true,
                "destOverride": [
                    "[http](https://www.json.cn/http)",
                    "tls",
                    "quic"
                ]
            }
        },
        {
            "tag": "🇺🇸 7391638636hax.localdomain trojan-direct",
            "protocol": "trojan",
            "port": 6922,
            "settings": {
                "clients": [
                    {
                        "password": "c15733b0-2866-4c57-82de-adabc55deb9e"
                    }
                ]
            },
            "streamSettings": {
                "network": "tcp",
                "security": "tls",
                "tlsSettings": {
                    "serverName": "addons.mozilla.org",
                    "certificates": [
                        {
                            "certificateFile": "/etc/argox/cert/cert.pem",
                            "keyFile": "/etc/argox/cert/private.key"
                        }
                    ]
                }
            },
            "sniffing": {
                "enabled": true,
                "destOverride": [
                    "http",
                    "tls",
                    "quic"
                ],
                "metadataOnly": false
            }
        },
        {
            "tag": "🇺🇸 7391638636hax.localdomain ss2022-direct",
            "protocol": "shadowsocks",
            "port": 30011,
            "settings": {
                "method": "2022-blake3-aes-128-gcm",
                "password": "cc+sFhTRk/NNBGwZogRgXg==",
                "network": "tcp,udp"
            },
            "sniffing": {
                "enabled": true,
                "destOverride": [
                    "http",
                    "tls",
                    "quic"
                ],
                "metadataOnly": false
            }
        }
    ],
    "dns": {
        "servers": [
            "https+local://8.8.8.8/dns-query"
        ]
    },
    "outbounds": [
        {
            "protocol": "freedom",
            "tag": "direct"
        },
        {
            "protocol": "blackhole",
            "settings": {

            },
            "tag": "block"
        },
        {
            "protocol": "wireguard",
            "tag": "wireguard",
            "settings": {
                "secretKey": "YFYOAdbw1bKTHlNNi+aEjBM3BO7unuFC5rOkMRAz9XY=",
                "address": [
                    "172.16.0.2/32",
                    "2606:4700:110:8a36:df92:102a:9602:fa18/128"
                ],
                "peers": [
                    {
                        "publicKey": "bmXOC+F1FxEMF9dyiK2H5/1SUtzH0JuVo51h2wPfgyo=",
                        "allowedIPs": [
                            "0.0.0.0/0",
                            "::/0"
                        ],
                        "endpoint": "engage.cloudflareclient.com:2408"
                    }
                ],
                "reserved": [
                    78,
                    135,
                    76
                ],
                "mtu": 1280
            }
        },
        {
            "protocol": "freedom",
            "tag": "warp-IPv4",
            "settings": {
                "domainStrategy": "UseIPv4"
            },
            "proxySettings": {
                "tag": "wireguard"
            }
        },
        {
            "protocol": "freedom",
            "tag": "warp-IPv6",
            "settings": {
                "domainStrategy": "UseIPv6"
            },
            "proxySettings": {
                "tag": "wireguard"
            }
        }
    ],
    "routing": {
        "domainStrategy": "AsIs",
        "rules": [
            {
                "type": "field",
                "domain": [
                    "api.openai.com"
                ],
                "outboundTag": "warp-IPv4"
            },
            {
                "type": "field",
                "domain": [
                    "geosite:openai"
                ],
                "outboundTag": "warp-IPv6"
            }
        ]
    }
}

客户端日志

null

服务端日志

null

Activity

  1. changed the title [-]xhttp (H3/QUIC) 入站通过 API rmi 移除后,UDP 端口未释放,仍在监听直到重启进程[/-] [+]xhttp (H3/QUIC) 入站通过 API rmi 移除后,UDP 端口未释放,仍在监听直到重启进程。其他方式没有这个问题[/+] on Aug 8, 2026
  2. Fangliding commented on Aug 8, 2026

    @Fangliding
    Member

    尝试
    c8bcc99

  3. LjhAUMEM commented on Aug 8, 2026

    @LjhAUMEM
    Contributor

    这个或许也可以作用 c2582a8

  4. fscarmen commented on Aug 8, 2026

    @fscarmen
    Author

    大佬们后续版本处理就行了,谢谢!

  5. reopened this on Aug 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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