Skip to content

fix: pass flow field in CreateUser and prevent NaN JSON crash#427

Merged
Ehco1996 merged 1 commit intomasterfrom
fix/vless-user-flow-and-nan-crash
Mar 13, 2026
Merged

fix: pass flow field in CreateUser and prevent NaN JSON crash#427
Ehco1996 merged 1 commit intomasterfrom
fix/vless-user-flow-and-nan-crash

Conversation

@Ehco1996
Copy link
Copy Markdown
Owner

Summary

  • VLESS flow fix: CreateUser() was missing the Flow parameter, so VLESS users were added to xray without flow, causing "account is not able to use the flow xtls-rprx-vision" errors
  • NaN crash fix: Division by zero in bandwidthRecorder and metric_reader produced NaN float64 values, which caused json: unsupported value: NaN fatal errors during config sync

Changes

  • pkg/xray/user.go: Add flow parameter to CreateUser() and pass it from syncUserConfigsFromServer()
  • pkg/xray/bandwidth_recorder.go: Guard elapsed > 0 before bandwidth division
  • pkg/metric_reader/node.go: Guard zero total values before CPU/memory/disk usage percentage calculations

Test plan

  • Verified VLESS + Reality end-to-end: panel config → ehco startup → client connection → traffic sync
  • go build ./... passes

🤖 Generated with Claude Code

- CreateUser was missing the Flow parameter, causing VLESS users to be
  added without flow field, resulting in "account is not able to use
  the flow xtls-rprx-vision" errors
- Add zero-division guard in bandwidthRecorder to prevent NaN when
  elapsed time is 0
- Add zero-division guard in metric_reader for CPU/memory/disk usage
  calculations to prevent NaN when total values are 0

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Ehco1996 Ehco1996 merged commit c7a5dcf into master Mar 13, 2026
0 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant