mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[GH-ISSUE #5714] [Bug]: "Start after first use" does not activate the subscription expiration date #3978
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#3978
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 @DS-83 on GitHub (Jul 1, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5714
Describe the bug
When creating a new client with Start after first use enabled and a subscription duration (e.g. a number of days) configured, the subscription does not receive an expiration date after the client's first successful connection.
Instead, the client continues to display the "days" indicator as if the subscription has not started, and no expiration timestamp is assigned.
How to reproduce the problem
Start with a clean 3x-ui installation.
Create a new client.
Enable Start after first use.
Set a subscription duration (e.g. 30 days).
Save the client configuration.
Connect using the client for the first time.
Refresh the client information in the panel.
Expected behavior
After the first successful client connection, the subscription should start automatically and an expiration date should be calculated and assigned based on the configured duration.
Actual behavior
The subscription start is never triggered. No expiration date is assigned, and the client continues to display only the configured number of days as if the subscription has not yet started.
Relevant logs
Screenshots
3x-ui version
3.4.2
Xray-core version
26.6.27
How did you install 3x-ui?
install.sh script
Operating system
CentOS 9
Which parts of the panel are affected?
Statistics / traffic counters
Browser (only if it is a UI bug)
No response
Is the panel behind a reverse proxy or CDN?
None
Before submitting
@github-actions[bot] commented on GitHub (Jul 1, 2026):
Thank you for the detailed report. I traced how "Start After First Use" is implemented and could not find an obvious break in the mechanism for a plain single-panel install, so I need a couple of specific details to pin this down rather than guess.
How the feature is implemented (confirmed in source)
expiryTime(e.g.-2592000000ms for 30 days) - seefrontend/src/pages/clients/ClientFormModal.tsx:464-466. The client is written to the Xray config immediately withenable: true; nothing blocks the connection until this value is activated.adjustTraffics(internal/web/service/inbound_traffic.go:183-284), which runs insideXrayTrafficJobevery 5 seconds (cadenceXrayTraffic = "@every 5s",internal/web/web.go:289). It only fires for a client whose email shows up in that poll's traffic report from Xray's stats API.internal/xray/api.go:655-668) treats the first time it ever sees a given per-user counter as a baseline (it is skipped, not reported as traffic) - so the conversion needs the client to have passed actual data through the proxy, and needs the following 5-second poll after that to see it, i.e. up to ~10 seconds after the first real traffic, not the mere act of connecting.client_traffics.expiry_timecolumn (internal/web/service/inbound_traffic.go:169-178), which is what the Clients page reads for the "days" column.Two related bugs already fixed in 3.4.2
6284061, merged 2026-06-15 - included in 3.4.1 and 3.4.2).client_traffics.inbound_id(after an inbound delete+recreate) made the lookup resolve no inbound and silently skip the conversion - also fixed, and covered by a regression test (TestAdjustTraffics_DelayedStartConvertsDespiteStaleInboundId).Since your report does not mention multi-node and you are already on 3.4.2, this does not look like either of those. To narrow it down, please provide:
sqlite3 /etc/x-ui/x-ui.db "SELECT email, expiry_time, up, down FROM client_traffics WHERE email='';"
A negative expiry_time means the conversion never ran; a positive one that the UI still shows as "not started" would point to a frontend/display issue instead.
XUI_LOG_LEVEL=debugset.This reply was generated automatically; a maintainer may follow up.
@DS-83 commented on GitHub (Jul 1, 2026):
A node/remote panel is involved.
Protocol: VLESS.
Yes. The client successfully transferred traffic through the proxy (not just a connection attempt), and I waited well over 15 seconds before refreshing the panel.
The database contains the correct expiration timestamp:
1798448344010So it appears that the backend does update the value correctly. The issue is that the panel continues to display the client as "Start after first use" with the configured number of days instead of showing the actual expiration date.
Unfortunately, I don't have debug logs available.
@MHSanaei commented on GitHub (Jul 2, 2026):
Fixed in
8dd3b31e: at the end of every node sync the master now lifts an activated deadline from client_traffics onto client records that still hold the negative "start after first use" duration, so the Clients page shows the real expiry date instead of the un-started day counter. Your existing panel will self-heal on the first node sync after updating. Will ship in the next release.