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

AIX Runtime Panic in Host #1661

Closed
aidangill-projects opened this issue Jun 6, 2024 · 2 comments
Closed

AIX Runtime Panic in Host #1661

aidangill-projects opened this issue Jun 6, 2024 · 2 comments

Comments

@aidangill-projects
Copy link
Contributor

aidangill-projects commented Jun 6, 2024

Describe the bug

I can't reproduce this, but I have gotten a few runtime panics with the following:

panic: runtime error: index out of range [1] with length 1

goroutine 66 [running]:
github.com/shirou/gopsutil/v4/host.UptimeWithContext({0x1003a53a0?, 0x11011edc0?})
        /home/runner/go/pkg/mod/github.com/shirou/gopsutil/v4@v4.24.5/host/host_aix.go:80 +0x510
github.com/shirou/gopsutil/v4/host.BootTimeWithContext({0x1003a53a0?, 0x11011edc0?})
        /home/runner/go/pkg/mod/github.com/shirou/gopsutil/v4@v4.24.5/host/host_aix.go:35 +0x3c github.com/shirou/gopsutil/v4/host.InfoWithContext({0x1003a53a0, 0x11011edc0})
        /home/runner/go/pkg/mod/github.com/shirou/gopsutil/v4@v4.24.5/host/host.go:96 +0x2d8 github.com/shirou/gopsutil/v4/host.Info(...)
        /home/runner/go/pkg/mod/github.com/shirou/gopsutil/v4@v4.24.5/host/host.go:62 main.getInfo()
        /home/runner/work/goagent/goagent/server_details.go:80 +0x38 main.getSystemInfo({0xa00010000482000, 0x14})
        /home/runner/work/goagent/goagent/server_details.go:46 +0x40 main.monitorThread()
        /home/runner/work/goagent/goagent/monitor_thread.go:12 +0x38 created by main.main in goroutine 1
        /home/runner/work/goagent/goagent/main.go:35 +0x248

While uptime returns:

# uptime
  06:48PM   up 2 days,  18:01,  1 user,  load average: 1.93, 2.02, 2.11

Which seems to be this line:

minutes, err = strconv.ParseUint(strings.Replace(hm[1], ",", "", -1), 10, 64)

If I see this again I will update + provide a fix

Environment (please complete the following information):

AIX PPC64

@aidangill-projects
Copy link
Contributor Author

It seems at exactly zero minutes, it returns 'X hrs', not X:00 - silly huh:

2024/06/06 01:47:12 08:47PM up 2 days, 20 hrs, 1 user, load average: 2.47, 2.17, 2.17
panic: runtime error: index out of range [1] with length 1

I will resolve and create a pull request

@Lomanic
Copy link
Collaborator

Lomanic commented Jun 18, 2024

Fixed in #1663

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants