mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[GH-ISSUE #5856] [Bug]: Xray stops listening local interfaces #4067
Labels
No labels
backlog
bug
clarification needed
documentation
duplicate
enhancement
github_actions
good first issue
invalid
javascript
New Feature
PR welcomed
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
MHSanaei/3x-ui#4067
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @aplafoe on GitHub (Jul 8, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5856
Describe the bug
Time by time Xray stops listen inbounds.
ss -tlnpdoesn't display them. xray logs, x-ui journalctl and dmesg also doesn't provide any helpful info. The web-panel displays xray-core as a normal running state. Restart x-ui service or just xray-core thru web-panel fix it, bit it happens again laterHow to reproduce the problem
I use reverse-proxy connection scheme, but other nodes with similar connection thru nginx works fine. I think fail2ban IP limit may affect
Expected behavior
Works without any manual or cron restarting
Actual behavior
Stops listen inbound interfaces
Relevant logs
Screenshots
Pre restart ss out

After restart ss out

3x-ui version
3.4.2
Xray-core version
26.6.27
How did you install 3x-ui?
install.sh script
Operating system
Ubuntu 24.04.4 LTS
Which parts of the panel are affected?
Statistics / traffic counters, Other
Browser (only if it is a UI bug)
No response
Is the panel behind a reverse proxy or CDN?
Yes — Nginx
Before submitting
@github-actions[bot] commented on GitHub (Jul 8, 2026):
Investigated in the current source (3x-ui v3.4.2 tag). Summary: the "process is alive but stopped listening" symptom is consistent with two things confirmed in the code, and your suspicion about IP Limit/fail2ban is plausible as the trigger.
1. The panel's "running" status is process-liveness only, not socket health.
internal/xray/process.goIsRunning()only checks that the child OS process hasn't exited (cmd.Process != niland thedonechannel isn't closed) — it never probes whether any inbound listener is actually accepting connections.XrayService.DidXrayCrash()(internal/web/service/xray.go:1140) is built directly on that same check, and it's what the automatic recovery job (CheckXrayRunningJob, running every second) uses to decide whether to auto-restart Xray. So a state where the process is alive and the gRPC API inbound still answers, but one or more client-facing inbounds have silently stopped accepting connections, is invisible to both the panel's status display and its auto-restart logic — matching what you observed (panel shows "running", nothing recovers on its own, andss -tlnpdisagrees).2. IP Limit enforcement does more than write to the fail2ban log — it also force-cycles the client on Xray's own gRPC API.
CheckClientIpJobruns every 10 seconds (internal/web/web.go:291,336). When a client exceedslimitIpand fail2ban is installed/enabled, besides writing the[LIMIT_IP]line fail2ban reads, it callsdisconnectClientTemporarily(internal/web/job/check_client_ip_job.go:558), which issuesRemoveUserimmediately followed byAddUseragainst Xray's HandlerService (AlterInbound) for that client on the inbound that owns it — independent of whatever fail2ban does at the firewall level. Your log shows the identicalKept 6 live IPs, queued 1 old IPs for fail2banline recurring several minutes apart, which means the same client stayed over its limit across many of the 10-second scans, so this remove/re-add cycle against that inbound's handler fired repeatedly rather than once.There is prior history of this exact code path (re-adding a client via the Xray API after an IP-limit disconnect) being fragile specifically for XHTTP inbounds: #4056 was a panic in
AddUsertriggered from this same call chain on XHTTP clients. That specific panic looks fixed now (the raw type assertions were replaced withgetRequiredUserString/getOptionalUserString, and cron jobs are wrapped incron.Recover, so a panic there would be logged, not crash the panel) — but it shows this mechanism has had real bugs on XHTTP before, and your reproduction steps specifically include avless+xhttpinbound.I can't confirm from 3x-ui's source alone whether repeated
AlterInbounduser churn is what's making Xray-core stop listening on that inbound, since that would be a fault inside Xray-core itself. To narrow it down, could you provide:limitIpto0for the affected clients (or temporarily disable/uninstall fail2ban on the slave node) while keeping everything else the same? This would confirm or rule out the IP-limit path as the trigger.xhttpinbound, only the rawtcpinbound, or both at once? If only one, which.debuglevel (Panel → Xray Configs → log level) captured across the moment the sockets disappear — the journalctl output you posted is atinfo/warningand may not show the failure itself.ulimit -non the slave node, and whetherdmesgshows anything (e.g.too many open files) around the failure time.x-uiversion matches the master (3.4.2), and whether fail2ban is installed on the slave itself (the[LIMIT_IP]enforcement runs against each panel's own local Xray, so fail2ban needs to be present on the node hosting the inbounds, not just the master).This reply was generated automatically by an AI agent supervised by the project's maintainers. A human maintainer may follow up.