3x-ui/internal
n0ctal 2bb29468d8
fix(xray): guard log-writer race and bound handler gRPC deadlines (#5442)
* perf(xray): compile log/traffic regexps once at package scope

GetTraffic recompiled two stats regexps on every traffic tick, and LogWriter.Write
recompiled two more on every log line. Hoist all four to package-level vars so they
compile once at load instead of per call on hot paths.

* fix(xray): guard LogWriter.lastLine against the GetResult reader race

Write is driven by the Xray process goroutine while Process.GetResult
reads lastLine from the caller's goroutine, so the unsynchronized field
is a data race under `go test -race`. Add an RWMutex and route every
write through setLastLine; GetResult reads via LastLine().

* fix(xray): bound handler gRPC calls with a deadline

AddInbound, DelInbound and the AddUser AlterInbound call used
context.Background(), so a hung core connection could block the caller
indefinitely (for example while the process restart lock is held). Give
them a 10s deadline (handlerRPCTimeout) and a nil-client guard, matching
the other handler operations.
2026-06-20 18:10:18 +02:00
..
config Test-quality audit: fix 2 prod bugs, strengthen weak tests, add mutation/fuzz/CI tooling (#5345) 2026-06-15 15:17:03 +02:00
database perf(db): add an index on settings.key (#5359) 2026-06-20 15:08:54 +03:30
eventbus feat(notifications): event bus architecture with Telegram and SMTP subscribers (#5326) 2026-06-15 21:03:41 +02:00
logger refactor(frontend): move form-item hints from extra to tooltip 2026-06-17 17:24:16 +02:00
mtproto refactor(frontend): move form-item hints from extra to tooltip 2026-06-17 17:24:16 +02:00
sub fix(sub): SS2022 share links must not base64-encode userinfo (#5432) 2026-06-20 11:25:12 +02:00
util fix(sub): SS2022 share links must not base64-encode userinfo (#5432) 2026-06-20 11:25:12 +02:00
web fix(sub): {{INBOUND}} = inbound remark, fix {{TRAFFIC_LEFT}} across inbounds (#5443) 2026-06-20 10:54:26 +02:00
xray fix(xray): guard log-writer race and bound handler gRPC deadlines (#5442) 2026-06-20 18:10:18 +02:00