Open EchoYun opened 1 month ago
The error log you're seeing indicates that the XrayR service is failing due to a runtime error caused by an "index out of range" issue within the code. Specifically, it occurs when the service tries to parse the Trojan node response. Here's a breakdown of what's happening:
Panic Error: The panic: runtime error: index out of range [0] with length 0 indicates that the code attempted to access an index of an array or slice that doesn't exist (i.e., trying to access the first element of an empty list).
Cause: The issue is within the ParseTrojanNodeResponse function in the v2raysocks.go file of the XrayR project. The service is attempting to parse some information from the API response related to the Trojan node, but it seems the expected data is missing or improperly formatted, leading to this error.
Frequent Restarts: The systemd log shows that the XrayR service is repeatedly restarting (2505 times), which indicates that the service keeps crashing shortly after starting up.
Possible Solutions: Check Configuration: Double-check the configuration files, especially related to the NodeID and NodeType. Ensure that the panel's API is returning valid data and that the configuration aligns with the expected inputs.
Update XrayR: Ensure you are using the latest version of XrayR. Sometimes these issues are fixed in newer versions of the software.
Custom Error Handling: You may need to look into the source code or raise an issue on the XrayR project's repository for better error handling in this scenario. The developers might need to add checks to prevent accessing empty or null data.
API Check: Since the issue might stem from the API response, manually test the API endpoints used by XrayR to ensure they are returning valid and complete data.
xrayr版本:0.9.4 系统版本:ubuntu24
日志: Jul 24 05:03:52 special-nodes-1.localdomain systemd[1]: XrayR.service: Failed with result 'exit-code'. Jul 24 05:04:02 special-nodes-1.localdomain systemd[1]: XrayR.service: Scheduled restart job, restart counter is at 2505. Jul 24 05:04:02 special-nodes-1.localdomain systemd[1]: Started XrayR.service - XrayR Service. Jul 24 05:04:02 special-nodes-1.localdomain XrayR[439376]: XrayR 0.9.4 (A Xray backend that supports many panels) Jul 24 05:04:02 special-nodes-1.localdomain XrayR[439376]: time="2024-07-24T05:04:02Z" level=info msg="Start the panel.." Jul 24 05:04:02 special-nodes-1.localdomain XrayR[439376]: 2024/07/24 05:04:02 [Warning] core: Xray 1.8.20 started Jul 24 05:04:03 special-nodes-1.localdomain XrayR[439376]: panic: runtime error: index out of range [0] with length 0 Jul 24 05:04:03 special-nodes-1.localdomain XrayR[439376]: goroutine 1 [running]: Jul 24 05:04:03 special-nodes-1.localdomain XrayR[439376]: github.com/XrayR-project/XrayR/api/v2raysocks.(APIClient).ParseTrojanNodeResponse(0xc001969180, 0xc001309860?) Jul 24 05:04:03 special-nodes-1.localdomain XrayR[439376]: github.com/XrayR-project/XrayR/api/v2raysocks/v2raysocks.go:374 +0x449 Jul 24 05:04:03 special-nodes-1.localdomain XrayR[439376]: github.com/XrayR-project/XrayR/api/v2raysocks.(APIClient).GetNodeInfo(0xc001969180) Jul 24 05:04:03 special-nodes-1.localdomain XrayR[439376]: github.com/XrayR-project/XrayR/api/v2raysocks/v2raysocks.go:189 +0xbb1 Jul 24 05:04:03 special-nodes-1.localdomain XrayR[439376]: github.com/XrayR-project/XrayR/service/controller.(Controller).Start(0xc00196cfc0) Jul 24 05:04:03 special-nodes-1.localdomain XrayR[439376]: github.com/XrayR-project/XrayR/service/controller/controller.go:82 +0xe2 Jul 24 05:04:03 special-nodes-1.localdomain XrayR[439376]: github.com/XrayR-project/XrayR/panel.(Panel).Start(0xc00193aa40) Jul 24 05:04:03 special-nodes-1.localdomain XrayR[439376]: github.com/XrayR-project/XrayR/panel/panel.go:209 +0x5ca Jul 24 05:04:03 special-nodes-1.localdomain XrayR[439376]: github.com/XrayR-project/XrayR/cmd.run() Jul 24 05:04:03 special-nodes-1.localdomain XrayR[439376]: github.com/XrayR-project/XrayR/cmd/root.go:106 +0x1c5 Jul 24 05:04:03 special-nodes-1.localdomain XrayR[439376]: github.com/XrayR-project/XrayR/cmd.init.func1(0xc00194e500?, {0x445389d?, 0x4?, 0x445378d?}) Jul 24 05:04:03 special-nodes-1.localdomain XrayR[439376]: github.com/XrayR-project/XrayR/cmd/root.go:27 +0x13 Jul 24 05:04:03 special-nodes-1.localdomain XrayR[439376]: github.com/spf13/cobra.(*Command).execute(0x780c840, {0xc000072910, 0x2, 0x2})