Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug - panic: runtime error: slice bounds out of range [:-1] #161

Open
iuriss opened this issue May 3, 2024 · 1 comment
Open

Bug - panic: runtime error: slice bounds out of range [:-1] #161

iuriss opened this issue May 3, 2024 · 1 comment

Comments

@iuriss
Copy link

iuriss commented May 3, 2024

Service had a panic

May 03 14:42:48 host systemd[1]: Started Linux Guest Agent.
May 03 14:42:48 host xe-daemon[5682]: panic: runtime error: slice bounds out of range [:-1]
May 03 14:42:48 host xe-daemon[5682]: goroutine 1 [running]:
May 03 14:42:48 host xe-daemon[5682]: xe-guest-utilities/guestmetric.(*Collector).CollectDisk(0xc000122018)
May 03 14:42:48 host xe-daemon[5682]: /builddir/build/BUILD/xe-guest-utilities-7.30.0/vendor/xe-guest-utilities/guestmetric/guestmetric_linux.go:290 +0xdb0
May 03 14:42:48 hostxe-daemon[5682]: main.main()
May 03 14:42:48 host xe-daemon[5682]: /builddir/build/BUILD/xe-guest-utilities-7.30.0/build/gobuild/xe-daemon/xe-daemon.go:114 +0xdab
May 03 14:42:48 host systemd[1]: xe-linux-distribution.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
May 03 14:42:48 host systemd[1]: xe-linux-distribution.service: Failed with result 'exit-code'.

I found this bug

I had /dev/xvdc1 which I created a PV with. However I had not created a VG with it. The process kept having the panic.

Once I created VG data with /dev/xvdc1. Then the service started accordingly.

@LunfanZhang
Copy link
Collaborator

LunfanZhang commented May 17, 2024

@iuriss I take a look at the call trace, the error happened when the agent tries to collect the disk metrics, specific on the pvs query. The output format of the pvs query command has changed, resulting in the parsed results of the regular expression not matching the expectation
Some improvements are necessary in the future I.M.O

  1. check if output format of the pvs query meet for our requirement before we obtain the value with index
  2. I presume a whole exception handling structure is needed as it is unacceptable that the whole process crash for only one metrics fails

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

No branches or pull requests

2 participants