[GH-ISSUE #5921] [Bug]: 某个客户端节点日期到期后,其余未到期的客户端节点使用vless xhttp reality会链接重置,只能重启X-ray才能用 #4106

Closed
opened 2026-10-31 20:37:13 +07:00 by bsakaguchi · 4 comments
Owner

Originally created by @1649861646 on GitHub (Jul 13, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5921

Describe the bug

[Bug]: 某个客户端节点日期到期后,其余未到期的客户端节点使用vless xhttp reality会链接重置,只能重启X-ray才行

How to reproduce the problem

添加一个新客户端,选择vless xhttp reality节点,设置个3分钟到期,到期后,就算是其他未到期的客户端使用vless xhttp reality这个节点也会出现链接重置,只能重启解决,ss协议不受影响

Expected behavior

No response

Actual behavior

No response

Relevant logs


Screenshots

No response

3x-ui version

3.5.0

Xray-core version

26.6.27

How did you install 3x-ui?

install.sh script

Operating system

Debian 13

Which parts of the panel are affected?

Other

Browser (only if it is a UI bug)

No response

Is the panel behind a reverse proxy or CDN?

None

Before submitting

  • I searched existing issues and this bug has not been reported.
  • I am running the latest released version of 3x-ui (or have verified the bug still exists on it).
  • This bug report is written in English.
  • I have redacted any sensitive data (tokens, real domains, client UUIDs).
Originally created by @1649861646 on GitHub (Jul 13, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5921 ### Describe the bug [Bug]: 某个客户端节点日期到期后,其余未到期的客户端节点使用vless xhttp reality会链接重置,只能重启X-ray才行 ### How to reproduce the problem 添加一个新客户端,选择vless xhttp reality节点,设置个3分钟到期,到期后,就算是其他未到期的客户端使用vless xhttp reality这个节点也会出现链接重置,只能重启解决,ss协议不受影响 ### Expected behavior _No response_ ### Actual behavior _No response_ ### Relevant logs ```shell ``` ### Screenshots _No response_ ### 3x-ui version 3.5.0 ### Xray-core version 26.6.27 ### How did you install 3x-ui? install.sh script ### Operating system Debian 13 ### Which parts of the panel are affected? Other ### Browser (only if it is a UI bug) _No response_ ### Is the panel behind a reverse proxy or CDN? None ### Before submitting - [x] I searched [existing issues](../issues?q=is%3Aissue) and this bug has not been reported. - [x] I am running the latest released version of 3x-ui (or have verified the bug still exists on it). - [x] This bug report is written in English. - [x] I have redacted any sensitive data (tokens, real domains, client UUIDs).
bsakaguchi 2026-10-31 20:37:13 +07:00
Author
Owner

@1649861646 commented on GitHub (Jul 13, 2026):

12:24:01
2026/07/13
ERROR
XRAY: transport/internet/splithttp: failed to serve HTTP for XHTTP > accept tcp [::]:443: use of closed network connection
12:20:32
2026/07/13
WARNING
X-UI: [POST /x-ui/panel/api/clients/update/oouez7y5ko handler=controller.(*ClientController).update client.go:169] Something went wrong Failed: record not found
12:15:02
2026/07/13
ERROR
XRAY: transport/internet/splithttp: failed to serve HTTP for XHTTP > accept tcp [::]:443: use of closed network connection

<!-- gh-comment-id:4954537792 --> @1649861646 commented on GitHub (Jul 13, 2026): 12:24:01 2026/07/13 ERROR XRAY: transport/internet/splithttp: failed to serve HTTP for XHTTP > accept tcp [::]:443: use of closed network connection 12:20:32 2026/07/13 WARNING X-UI: [POST /x-ui/panel/api/clients/update/oouez7y5ko handler=controller.(*ClientController).update client.go:169] Something went wrong Failed: record not found 12:15:02 2026/07/13 ERROR XRAY: transport/internet/splithttp: failed to serve HTTP for XHTTP > accept tcp [::]:443: use of closed network connection
Author
Owner

@github-actions[bot] commented on GitHub (Jul 13, 2026):

Title: 客户端到期自动禁用后,同一个 vless+xhttp+reality inbound 上其他在线客户端的连接被重置

Severity: High

Category: Reliability

Why this matters:
客户端到期后面板的处理路径是"就地摘除该客户端",设计上不应该影响同一 inbound 下其它客户端。完整链路(均已在源码中确认):

  • internal/web/service/inbound_disable.go 第 57-70 行:expiry_time > 0 AND expiry_time <= now 命中后,disableInvalidClients 把该 client 标记为 enable=false。
  • internal/web/service/inbound_traffic.go 第 54-67 行:AddTraffic 检测到有 client 被禁用后返回 clientsDisabled=true。
  • internal/web/job/xray_traffic_job.go 第 55-66 行:只要面板设置"客户端自动禁用后重启 Xray"保持默认开启(internal/web/service/setting.go 第 111 行默认值 true),就会立即调用 XrayService.RestartXray(false)。
  • internal/web/service/xray.go 第 163-166 行:重新生成配置时,被禁用的 client 会整个从该 inbound 的 settings.clients 中剔除,其余 client 原样保留。
  • internal/web/service/xray.go 第 985-1098 行:RestartXray(false) 并不直接重启进程,而是先调用 tryHotApply,通过 Xray 的 gRPC HandlerService 只下发"增量"操作(例如只删除过期的那一个 user),使其它连接不受影响;只有当 internal/xray/hot_diff.go 的 ComputeHotDiff 判定这次变更"无法通过 API 增量应用"时,才会回退成更重的操作。项目自己的架构文档 docs/architecture.md 明确把"不该重启却重启、导致连接被杀"列为 hot_diff.go 误判会触发的已知风险类别。
  • 关键在于 internal/xray/hot_diff.go 第 115-139 行的 diffInbounds:如果针对某个 inbound 的 diffInboundUsers(同文件第 157-200 行,只对 vless/vmess/trojan 生效)判定失败,代码不会整体重启 Xray 进程,而是只对这一个 inbound 调用 RemoveInbound+AddInbound(第 131-138 行)。这能完整解释你看到的现象:只有到期客户端所在的这一个 vless+xhttp+reality inbound 被整体摘除重建(该 inbound 下所有客户端的连接一起被重置/RST),而独立的 ss inbound 因为配置完全没变,不会被触碰。

仅凭现有报告,无法判断具体是(a)这个 inbound 的某个字段被 diffInboundUsers 误判为"结构性变化"从而整体重建,还是(b)Xray-core 处理 xhttp 传输下 AlterInbound(internal/xray/api.go 第 639-655 行)本身对同 inbound 其它连接有副作用(这部分不在 3x-ui 代码范围内)。

Recommendation:
定位需要以下信息,麻烦提供:

  1. 在 /etc/default/x-ui 中加入一行 XUI_LOG_LEVEL=debug,然后 systemctl restart x-ui(该文件是 x-ui.service 的 EnvironmentFile)。复现问题后查看日志(x-ui 菜单 → 日志管理 → "Debug Log",等价于 journalctl -u x-ui -e --no-pager -f -p debug),重点看客户端到期前后是否出现:
    • Xray config changes applied through the core API, no restart needed(说明只做了增量操作,其它连接理论上不受影响);或者
    • hot diff: 开头的调试信息(说明某个判定失败,对该 inbound 做了整体重建)。
  2. 该 vless+xhttp+reality inbound 的完整配置(clients 部分请脱敏),尤其是是否有 client 配置了 reverse 转发。
  3. 确认面板设置里"客户端自动禁用后重启 Xray"当前是否为默认开启状态。

Confidence: 中等。"自动禁用触发增量优先、失败回退到该 inbound 整体重建/重启"这条机制在源码中是明确的;但具体命中的是 diffInboundUsers 判定失败还是 Xray-core 自身在 xhttp 下的行为,需要上面第 1 项的调试日志才能确认。

Example:

// internal/xray/hot_diff.go:128-138
if exists && diffInboundUsers(oldIb, newIb, diff) {
    continue
}
diff.RemovedInboundTags = append(diff.RemovedInboundTags, oldIb.Tag)
if exists {
    raw, err := json.Marshal(newIb)
    ...
    diff.AddedInbounds = append(diff.AddedInbounds, raw)
}

@MHSanaei 需要你或提交者补充上述调试日志,才能确认具体命中的分支并决定修复方向。

This reply was generated automatically; a maintainer may follow up.

<!-- gh-comment-id:4954563273 --> @github-actions[bot] commented on GitHub (Jul 13, 2026): Title: 客户端到期自动禁用后,同一个 vless+xhttp+reality inbound 上其他在线客户端的连接被重置 Severity: High Category: Reliability Why this matters: 客户端到期后面板的处理路径是"就地摘除该客户端",设计上不应该影响同一 inbound 下其它客户端。完整链路(均已在源码中确认): - `internal/web/service/inbound_disable.go` 第 57-70 行:`expiry_time > 0 AND expiry_time <= now` 命中后,`disableInvalidClients` 把该 client 标记为 `enable=false`。 - `internal/web/service/inbound_traffic.go` 第 54-67 行:`AddTraffic` 检测到有 client 被禁用后返回 `clientsDisabled=true`。 - `internal/web/job/xray_traffic_job.go` 第 55-66 行:只要面板设置"客户端自动禁用后重启 Xray"保持默认开启(`internal/web/service/setting.go` 第 111 行默认值 `true`),就会立即调用 `XrayService.RestartXray(false)`。 - `internal/web/service/xray.go` 第 163-166 行:重新生成配置时,被禁用的 client 会整个从该 inbound 的 `settings.clients` 中剔除,其余 client 原样保留。 - `internal/web/service/xray.go` 第 985-1098 行:`RestartXray(false)` 并不直接重启进程,而是先调用 `tryHotApply`,通过 Xray 的 gRPC HandlerService 只下发"增量"操作(例如只删除过期的那一个 user),使其它连接不受影响;只有当 `internal/xray/hot_diff.go` 的 `ComputeHotDiff` 判定这次变更"无法通过 API 增量应用"时,才会回退成更重的操作。项目自己的架构文档 `docs/architecture.md` 明确把"不该重启却重启、导致连接被杀"列为 `hot_diff.go` 误判会触发的已知风险类别。 - 关键在于 `internal/xray/hot_diff.go` 第 115-139 行的 `diffInbounds`:如果针对某个 inbound 的 `diffInboundUsers`(同文件第 157-200 行,只对 vless/vmess/trojan 生效)判定失败,代码**不会**整体重启 Xray 进程,而是只对**这一个 inbound** 调用 `RemoveInbound`+`AddInbound`(第 131-138 行)。这能完整解释你看到的现象:只有到期客户端所在的这一个 vless+xhttp+reality inbound 被整体摘除重建(该 inbound 下所有客户端的连接一起被重置/RST),而独立的 ss inbound 因为配置完全没变,不会被触碰。 仅凭现有报告,无法判断具体是(a)这个 inbound 的某个字段被 `diffInboundUsers` 误判为"结构性变化"从而整体重建,还是(b)Xray-core 处理 xhttp 传输下 `AlterInbound`(`internal/xray/api.go` 第 639-655 行)本身对同 inbound 其它连接有副作用(这部分不在 3x-ui 代码范围内)。 Recommendation: 定位需要以下信息,麻烦提供: 1. 在 `/etc/default/x-ui` 中加入一行 `XUI_LOG_LEVEL=debug`,然后 `systemctl restart x-ui`(该文件是 `x-ui.service` 的 `EnvironmentFile`)。复现问题后查看日志(`x-ui` 菜单 → 日志管理 → "Debug Log",等价于 `journalctl -u x-ui -e --no-pager -f -p debug`),重点看客户端到期前后是否出现: - `Xray config changes applied through the core API, no restart needed`(说明只做了增量操作,其它连接理论上不受影响);或者 - `hot diff:` 开头的调试信息(说明某个判定失败,对该 inbound 做了整体重建)。 2. 该 vless+xhttp+reality inbound 的完整配置(clients 部分请脱敏),尤其是是否有 client 配置了 `reverse` 转发。 3. 确认面板设置里"客户端自动禁用后重启 Xray"当前是否为默认开启状态。 Confidence: 中等。"自动禁用触发增量优先、失败回退到该 inbound 整体重建/重启"这条机制在源码中是明确的;但具体命中的是 `diffInboundUsers` 判定失败还是 Xray-core 自身在 xhttp 下的行为,需要上面第 1 项的调试日志才能确认。 Example: ```go // internal/xray/hot_diff.go:128-138 if exists && diffInboundUsers(oldIb, newIb, diff) { continue } diff.RemovedInboundTags = append(diff.RemovedInboundTags, oldIb.Tag) if exists { raw, err := json.Marshal(newIb) ... diff.AddedInbounds = append(diff.AddedInbounds, raw) } ``` @MHSanaei 需要你或提交者补充上述调试日志,才能确认具体命中的分支并决定修复方向。 *This reply was generated automatically; a maintainer may follow up.*
Author
Owner

@1649861646 commented on GitHub (Jul 13, 2026):

请求修复,非常严重的bug,目前所有vless xhttp reality只要一个客户端到期,所有客户端都无法使用!!,必须重启

<!-- gh-comment-id:4956965338 --> @1649861646 commented on GitHub (Jul 13, 2026): 请求修复,非常严重的bug,目前所有vless xhttp reality只要一个客户端到期,所有客户端都无法使用!!,必须重启
Author
Owner

@1649861646 commented on GitHub (Jul 13, 2026):

搞错了,不是3x-ui的问题。。。还是那个utls的问题,因为用新的app还可以继续用

<!-- gh-comment-id:4958735613 --> @1649861646 commented on GitHub (Jul 13, 2026): 搞错了,不是3x-ui的问题。。。还是那个utls的问题,因为用新的app还可以继续用
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MHSanaei/3x-ui#4106
No description provided.