mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[GH-ISSUE #6112] [Bug]:X-Ray stops responding randomly after 1–3 days. #4223
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#4223
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 @goldnayk-cyber on GitHub (Jul 26, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6112
Describe the bug
Suddenly, the server stops establishing VPN connections. This happens "randomly." The panel is operational and shows some connections, but the specific connections being attempted right now are missing, and connectivity to other nodes is lost (no connection, even though the nodes themselves are confirmed to be running). Restarting X-Ray does not resolve the issue; service is restored only by rebooting the server.
The web panel is working.
X-Ray reports that it is running.
SSH access to the server is available, and everything else is functioning.
When attempting to connect, Hiddify returns a timeout error (using the VLESS gRPC Reality transport).
The server is located behind a Traefik reverse proxy, but the issue persists even when the port is forwarded directly to it.
Time synchronization is configured.
@def:/var/log/x-ui# timedatectl timesync-status
Server: 83.243.68.157 (0.debian.pool.ntp.org)
Poll interval: 34min 8s (min: 32s; max 34min 8s)
Leap: normal
Version: 4
Stratum: 2
Reference: C23ACF4F
Precision: 4us (-18)
Root distance: 5.508ms (max: 5s)
Offset: +9.220ms
Delay: 27.639ms
Jitter: 7.534ms
Packet count: 7
Frequency: +9,095ppm
This is a physical machine that I set up myself and installed Debian 13.5 on.
This machine handles the reverse proxy and the Apache Guacamole service.
How to reproduce the problem
The problem occurs randomly—once a day, several times a day, or once a week.
Expected behavior
I expected the panel to show some kind of error.
Actual behavior
The panel showed no errors.
Relevant logs
Screenshots
No response
3x-ui version
3.5.0
Xray-core version
26.7.11
How did you install 3x-ui?
install.sh script
Operating system
Debian 13.5
Which parts of the panel are affected?
No response
Browser (only if it is a UI bug)
No response
Is the panel behind a reverse proxy or CDN?
Yes — other
Before submitting
@github-actions[bot] commented on GitHub (Jul 26, 2026):
I could not reproduce this as a panel-side defect from the evidence given, but the single most informative detail in your report is that restarting Xray does not recover the service while a reboot does. That places the stuck state outside the Xray process, so the next step is to narrow down where the block actually sits. Two things confirmed in the source first, because they explain what you did and did not see.
Why the panel showed no error. The "Xray is running" state is process liveness only.
process.IsRunning()(internal/xray/process.go:244) checks only that the child process has not exited;XrayService.IsXrayRunning(internal/web/service/xray.go:40) andDidXrayCrash(internal/web/service/xray.go:1232) are built on it, andDidXrayCrashis what the automatic recovery job uses (internal/web/job/check_xray_running_job.go). A core that is alive but no longer serving connections is invisible to both the status display and the auto-restart. This is a known limitation, discussed in #5856, which is a related but not identical report (there a restart did recover it).Check the IP-limit fail2ban jail before anything else. If IP Limit was ever enabled from the
x-uimenu,create_iplimit_jails(x-ui.sh:2488) writes/etc/fail2ban/action.d/3x-ipl.conf, whoseactionban(x-ui.sh:2546) blocks the source IP on every TCP and UDP port except SSH and the panel port (exemptports, built atx-ui.sh:2523-2529). That produces your exact symptom profile — SSH fine, panel fine, proxy traffic timing out — and an iptables rule is not cleared by restarting Xray. While the problem is happening:An empty chain rules this out. The default bantime is 30 minutes (
x-ui.sh:2490), so a longer configured bantime would be needed to match your durations.Beyond that, your own log shows outbound calls failing too (
node traffic sync: fetch from ... failed), so it is not only inbound traffic. Please capture the following while the failure is active, since these distinguish an Xray-level wedge from a host-level one:ss -tlnp | grep -F <your inbound port>— is Xray still listening on the inbound at all.curl -sv --max-time 10 https://www.cloudflare.com/cdn-cgi/tracefrom the server — can the box open any new outbound connection.ss -sandss -tan | awk '{print $1}' | sort | uniq -c— socket-state totals. Large CLOSE-WAIT/LAST-ACK counts were the pattern in #4678.dmesg -T | tail -50andsysctl net.netfilter.nf_conntrack_count net.netfilter.nf_conntrack_max— a full conntrack table gives exactly "existing SSH session survives, new connections dropped, only a reboot clears it", and you are running Docker (Traefik, Guacamole), sonf_conntrackis loaded.cat /proc/$(pgrep -f 'x-ui/bin/xray')/limits | grep -i 'open files'andls /proc/$(pgrep -f 'x-ui/bin/xray')/fd | wc -l. The shipped unitx-ui.service.debiansets noLimitNOFILE, so the panel and its Xray child inherit systemd's default.debuglevel (panel → Xray Configs → log level) covering the moment connections stop. The journal output you posted is at info/warning and would not show the failure itself.One more datapoint that would help: whether the interval changes if you temporarily run a plain VLESS REALITY inbound without the gRPC transport. Xray 26.7.11 prints the "gRPC transport is deprecated" warning your log shows, and if the wedge is transport-specific that would isolate it to Xray-core rather than the panel.
Separately, and unrelated to the main symptom: your log shows
x-uistarting at boot before PostgreSQL was reachable and exiting withError initializing database: ... dial tcp 127.0.0.1:5432. The shipped unit only orders itselfAfter=network.target(x-ui.service.debian), so with the database in a container it can start too early;Restart=on-failurewithRestartSec=5srecovered it on the second attempt, which is why it is only a failed start in the log. A systemd drop-in addingAfter=docker.service(or your PostgreSQL unit) removes that first failure.Also worth noting: logins are recorded from
172.18.0.3, i.e. the panel sees the Traefik container address rather than the real client address. That is cosmetic unless you use per-client IP limits, in which case seedocs/real-client-ip.mdfor the Sockopt "Real client IP" settings.Keeping this open and labelled as needing clarification until the data above narrows it down.
This reply was generated automatically. A maintainer may follow up.
@goldnayk-cyber commented on GitHub (Jul 27, 2026):
There is currently an active error.
There are no blocked IPs.
@df:/home/# fail2ban-client status 3x-ipl
Status for the jail: 3x-ipl
|- Filter
| |- Currently failed: 0
| |- Total failed: 0
|
- File list: /var/log/x-ui/3xipl.log- Actions|- Currently banned: 0
|- Total banned: 0
`- Banned IP list:
@df:/home/**# iptables -L f2b-3x-ipl -n
iptables: No chain/target/match by that name.
A timeout occurs upon connection, yet the VPN session appears to be active; the web panel is accessible, but other websites are not.
@df:/home/***# ss -tlnp | grep -F 11111
LISTEN 0 4096 *:11111 : users:(("xray-linux-amd6",pid=194 9,fd=10))
@df:/home/***# curl -sv --max-time 10 https://www.cloudflare.com/cdn-cgi/trace
@df:/home/***# ss -s
Total: 245
TCP: 112 (estab 29, closed 63, orphaned 0, timewait 22)
Transport Total IP IPv6
RAW 4 1 3
UDP 4 2 2
TCP 49 35 14
INET 57 38 19
FRAG 0 0 0
@df:/home/***# ss -tan | awk '{print $1}' | sort | uniq -c
30 ESTAB
20 LISTEN
1 State
21 TIME-WAIT
@df:/home/***# dmesg -T | tail -50
[Пн июл 27 07:07:21 2026] sr 2:0:0:0: Power-on or device reset occurred
[Пн июл 27 07:11:31 2026] usb 3-4: reset high-speed USB device number 2 using xhci_hcd
[Пн июл 27 07:11:33 2026] sr 2:0:0:0: Power-on or device reset occurred
[Пн июл 27 07:14:44 2026] usb 3-4: reset high-speed USB device number 2 using xhci_hcd
[Пн июл 27 07:14:46 2026] sr 2:0:0:0: Power-on or device reset occurred
[Пн июл 27 07:21:19 2026] usb 3-4: reset high-speed USB device number 2 using xhci_hcd
[Пн июл 27 07:21:21 2026] sr 2:0:0:0: Power-on or device reset occurred
[Пн июл 27 07:31:21 2026] usb 3-4: reset high-speed USB device number 2 using xhci_hcd
[Пн июл 27 07:31:23 2026] sr 2:0:0:0: Power-on or device reset occurred
[Пн июл 27 07:37:42 2026] usb 3-4: reset high-speed USB device number 2 using xhci_hcd
[Пн июл 27 07:37:44 2026] sr 2:0:0:0: Power-on or device reset occurred
[Пн июл 27 07:41:35 2026] usb 3-4: reset high-speed USB device number 2 using xhci_hcd
[Пн июл 27 07:41:38 2026] sr 2:0:0:0: Power-on or device reset occurred
[Пн июл 27 07:42:35 2026] usb 3-4: reset high-speed USB device number 2 using xhci_hcd
[Пн июл 27 07:42:37 2026] sr 2:0:0:0: Power-on or device reset occurred
[Пн июл 27 07:50:11 2026] usb 3-4: reset high-speed USB device number 2 using xhci_hcd
[Пн июл 27 07:50:14 2026] sr 2:0:0:0: Power-on or device reset occurred
[Пн июл 27 07:55:37 2026] usb 3-4: reset high-speed USB device number 2 using xhci_hcd
[Пн июл 27 07:55:39 2026] sr 2:0:0:0: Power-on or device reset occurred
[Пн июл 27 07:56:53 2026] usb 3-4: reset high-speed USB device number 2 using xhci_hcd
[Пн июл 27 07:56:55 2026] sr 2:0:0:0: Power-on or device reset occurred
[Пн июл 27 08:11:23 2026] usb 3-4: reset high-speed USB device number 2 using xhci_hcd
[Пн июл 27 08:11:25 2026] sr 2:0:0:0: Power-on or device reset occurred
[Пн июл 27 08:22:41 2026] usb 3-4: reset high-speed USB device number 2 using xhci_hcd
[Пн июл 27 08:22:43 2026] sr 2:0:0:0: Power-on or device reset occurred
[Пн июл 27 08:24:19 2026] usb 3-4: reset high-speed USB device number 2 using xhci_hcd
[Пн июл 27 08:24:22 2026] sr 2:0:0:0: Power-on or device reset occurred
[Пн июл 27 08:26:08 2026] usb 3-4: reset high-speed USB device number 2 using xhci_hcd
[Пн июл 27 08:26:10 2026] sr 2:0:0:0: Power-on or device reset occurred
[Пн июл 27 08:35:43 2026] usb 3-4: reset high-speed USB device number 2 using xhci_hcd
[Пн июл 27 08:35:46 2026] sr 2:0:0:0: Power-on or device reset occurred
[Пн июл 27 08:36:57 2026] usb 3-4: reset high-speed USB device number 2 using xhci_hcd
[Пн июл 27 08:36:59 2026] sr 2:0:0:0: Power-on or device reset occurred
[Пн июл 27 08:42:56 2026] usb 3-4: reset high-speed USB device number 2 using xhci_hcd
[Пн июл 27 08:42:58 2026] sr 2:0:0:0: Power-on or device reset occurred
[Пн июл 27 08:44:42 2026] usb 3-4: reset high-speed USB device number 2 using xhci_hcd
[Пн июл 27 08:44:44 2026] sr 2:0:0:0: Power-on or device reset occurred
[Пн июл 27 08:46:08 2026] usb 3-4: reset high-speed USB device number 2 using xhci_hcd
[Пн июл 27 08:46:10 2026] sr 2:0:0:0: Power-on or device reset occurred
[Пн июл 27 08:47:38 2026] usb 3-4: reset high-speed USB device number 2 using xhci_hcd
[Пн июл 27 08:48:11 2026] usb 3-4: reset high-speed USB device number 2 using xhci_hcd
[Пн июл 27 08:48:13 2026] sr 2:0:0:0: Power-on or device reset occurred
[Пн июл 27 08:49:35 2026] usb 3-4: reset high-speed USB device number 2 using xhci_hcd
[Пн июл 27 08:49:37 2026] sr 2:0:0:0: Power-on or device reset occurred
[Пн июл 27 08:50:32 2026] usb 3-4: reset high-speed USB device number 2 using xhci_hcd
[Пн июл 27 08:50:34 2026] sr 2:0:0:0: Power-on or device reset occurred
[Пн июл 27 08:58:46 2026] usb 3-4: reset high-speed USB device number 2 using xhci_hcd
[Пн июл 27 08:58:48 2026] sr 2:0:0:0: Power-on or device reset occurred
[Пн июл 27 09:12:35 2026] usb 3-4: reset high-speed USB device number 2 using xhci_hcd
[Пн июл 27 09:12:37 2026] sr 2:0:0:0: Power-on or device reset occurred
@df:/home/***# sysctl net.netfilter.nf_conntrack_count net.netfilter.nf_conntrack_max
net.netfilter.nf_conntrack_count = 1570
net.netfilter.nf_conntrack_max = 262144
@df:/home/***# cat /proc/$(pgrep -f 'x-ui/bin/xray')/limits | grep -i 'open files'
cat: /proc//limits: Нет такого файла или каталога
@df:/home/***# ls /proc/$(pgrep -f 'x-ui/bin/xray')/fd | wc -l
ls: невозможно получить доступ к '/proc//fd': Нет такого файла или каталога
0
I'm seeing some DNS issues.
@goldnayk-cyber commented on GitHub (Jul 27, 2026):
Tailscale is also installed on the server.
@goldnayk-cyber commented on GitHub (Jul 27, 2026):
The result changed after adding Google DNS.
nano /etc/resolv.conf
@d*f:/home/*****# curl -sv --max-time 10 https://www.cloudflare.com/cdn-cgi/trace
< HTTP/2 200
< date: Mon, 27 Jul 2026 06:31:24 GMT
< content-type: text/plain
< content-length: 215
< if-modified-since: off
< expires: Thu, 01 Jan 1970 00:00:01 GMT
< access-control-allow-origin: *
< set-cookie: __cf_bm=ZPt9gxPfZROfxF.5B6YsdoktFy909ZJwoxnL0p8mFPQ-1785133884.148892-1.0.1.1-tWwoW6Ou21p9X707clm4BMb_9RLOHbZg5wuPkQ0hOHO5jlTPb.Gr9e9.hWRCDW59fK9aXo9x9aYI5Ig3RPKdSQGHVTh78jZKEUr4YJc.gKnKN5eFa1tSsVEi0LI6sZOk; HttpOnly; SameSite=None; Secure; Path=/; Domain=www.cloudflare.com; Expires=Mon, 27 Jul 2026 07:01:24 GMT
< report-to: {"group":"cf-nel","max_age":604800,"endpoints":[{"url":"https://a.nel.cloudflare.com/report/v4?s=apaNN9Ur9X392fY28kPniHc9Wd1YnKS2eWWX37voZcaxaVapc5WnHWYkatD4r%2FPshNXxa5nbiFo46%2B10vDgrcvDYy0QonTgvpMdzO%2FCOWbKXKBC%2FtOFiH5HYzf%2F5krieIKIdNg%3D%3D"}]}
< nel: {"report_to":"cf-nel","success_fraction":0.0,"max_age":604800}
< server: cloudflare
< cf-ray: a21999d7ee52e48b-DME
<
fl=903f63
h=www.cloudflare.com
ip=85.234.24.182
ts=1785133884.000
visit_scheme=https
uag=curl/8.14.1
colo=DME
sliver=none
http=http/2
loc=RU
tls=TLSv1.3
sni=plaintext
warp=off
gateway=off
rbi=off
kex=X25519MLKEM768
@goldnayk-cyber commented on GitHub (Jul 27, 2026):
The server came back to life after adding Google DNS to the file # nano /etc/resolv.conf
However, the file was overwritten again.
resolv.conf(5) file generated by tailscale
For more info, see https://tailscale.com/s/resolvconf-overwrite
DO NOT EDIT THIS FILE BY HAND -- CHANGES WILL BE OVERWRITTEN
nameserver 100.100.100.100
nameserver fd7a:115c:a1e0::53
search tailf3234c.ts.net
@MHSanaei commented on GitHub (Jul 27, 2026):
Closing this as an environment issue — your own last two comments identified it, and the evidence is conclusive.
While the failure was active:
DNS resolution was dead, and everything else follows from that. Adding a working nameserver to
/etc/resolv.confbrought the server back immediately, and the file was then overwritten:Tailscale's MagicDNS takes over
/etc/resolv.confand points the system at100.100.100.100. When that resolver stops answering, the box can no longer resolve anything: Xray cannot resolve destinations so proxied connections time out while the tunnel itself looks established, and the panel's ownnode traffic sync: fetch from … failedwarnings are the same failure on the outbound side. SSH and the panel keep working because both are reached by IP.It also explains the two things that looked most confusing:
The fail2ban check you ran rules out the IP-limit jail (
Currently banned: 0, nof2b-3x-iplchain), so that is not involved.To fix it properly, configure DNS through Tailscale rather than by editing
resolv.conf, which Tailscale will keep rewriting:1.1.1.1or8.8.8.8) so MagicDNS has an upstream to fall back on; ortailscale set --accept-dns=falseon this host, which leaves/etc/resolv.confunder your control.There is one genuine panel-side observation in your log worth acting on separately:
x-uistarted before PostgreSQL was reachable and exited withError initializing database: … dial tcp 127.0.0.1:5432.Restart=on-failurerecovered it on the next attempt, so it is only a failed start, but a systemd drop-in withAfter=docker.service(or your PostgreSQL unit) removes it.If connections stop again while
curlcan resolve and reach the internet from that box, please reopen with Xray's log atdebuglevel covering the moment it happens — that would be a different problem and worth tracing.