Skip to content
This repository has been archived by the owner on Aug 29, 2020. It is now read-only.

Panic on Mac caused by cpu percentages issue #9

Closed
ehlxr opened this issue Apr 9, 2018 · 32 comments · Fixed by #28
Closed

Panic on Mac caused by cpu percentages issue #9

ehlxr opened this issue Apr 9, 2018 · 32 comments · Fixed by #28
Labels
bug Something isn't working

Comments

@ehlxr
Copy link

ehlxr commented Apr 9, 2018

panic: runtime error: index out of range

goroutine 6 [running]:
github.com/cjbassi/gotop/widgets.(*CPU).update(0xc42000afc0)
	/home/cjbassi/go/src/github.com/cjbassi/gotop/widgets/cpu.go:52 +0x3c9
created by github.com/cjbassi/gotop/widgets.NewCPU
	/home/cjbassi/go/src/github.com/cjbassi/gotop/widgets/cpu.go:35 +0x2cc
@chlins
Copy link

chlins commented Apr 9, 2018

2018-04-09 4 54 09
Mac OS 10.13.3

@heruan
Copy link

heruan commented Apr 9, 2018

Same here, running macOS 10.13.4. Installed with:

sh -c "$(curl https://raw.githubusercontent.com/cjbassi/gotop/master/download.sh)"

@danielmunoz
Copy link

Same. Running macOS 10.12.6.

panic: runtime error: index out of range

goroutine 6 [running]:
github.com/cjbassi/gotop/widgets.(*CPU).update(0xc42000b080)
	/home/cjbassi/go/src/github.com/cjbassi/gotop/widgets/cpu.go:52 +0x3c9
created by github.com/cjbassi/gotop/widgets.NewCPU
	/home/cjbassi/go/src/github.com/cjbassi/gotop/widgets/cpu.go:35 +0x2cc

@cjbassi
Copy link
Owner

cjbassi commented Apr 9, 2018

I don't have a mac to test on, but I just pushed a commit to the repo and I'd appreciate if someone could go get github.com/cjbassi/gotop, run gotop, and then let me know what happens or what the error messages are this time. Thanks!

@cjbassi
Copy link
Owner

cjbassi commented Apr 9, 2018

@chlins is a different issue I think, similar to #12.

@pbnj
Copy link

pbnj commented Apr 9, 2018

@cjbassi - I just ran go get github.com/cjbassi/gotop and ran $GOPATH/bin/gotop, but it's completely blank nothing happens.

Also, tried go build and running ./gotop. Same result.

screen shot 2018-04-09 at 11 20 20 am

@cjbassi
Copy link
Owner

cjbassi commented Apr 9, 2018

@petermbenjamin Are you also on OSX? What terminal are you using?

@cjbassi
Copy link
Owner

cjbassi commented Apr 9, 2018

Also, are these issues on startup? Or when?

@pbnj
Copy link

pbnj commented Apr 9, 2018

@cjbassi:

  • yes, I'm on macOS Sierra 10.12.6.
  • Terminal Stack: iTerm + zsh + oh-my-zsh
  • The issue is at startup from what I can tell. Launching gotop command just hangs.

Update 1: I'm also running inside tmux v2.6

@pbnj
Copy link

pbnj commented Apr 9, 2018

@cjbassi - ok, some updates.

  • I tried it on Terminal.app (native terminal client on macOS). It took a few minutes (~ 1-2 mins) before gotop displayed the visualizations.

screen shot 2018-04-09 at 1 28 40 pm

  • I tried it on iTerm and waited a few minutes to compare. It erred out with the following error message:

screen shot 2018-04-09 at 1 31 30 pm

Update 1:

screen shot 2018-04-09 at 1 33 50 pm

@cjbassi
Copy link
Owner

cjbassi commented Apr 9, 2018

@petermbenjamin I appreciate all the troubleshooting you're doing. Looks like the index out of range error is the same one that chlins is getting. I just pushed some changes that include better error logging so it'd help if you could update and build/run from source and see what the errors give you this time.

@viktor-evdokimov
Copy link

Just checked with the same config as @petermbenjamin but without tmux. It seems to work, only i have light solar theme and text is white on white

screen shot 2018-04-09 at 6 16 47 pm

@cjbassi cjbassi added the bug Something isn't working label Apr 10, 2018
@cjbassi
Copy link
Owner

cjbassi commented Apr 10, 2018

@viktor-evdokimov I think the issue there is that the default colorscheme for gotop has a transparent background which doesn't look great on white colored terminals. You could try one of the other colorschemes by using the -c flag, or if none of those work I could add a colorscheme that better suits white backgrounds.

@cjbassi
Copy link
Owner

cjbassi commented Apr 10, 2018

@viktor-evdokimov Just added the 'default-dark' colorscheme for brighter backgrounds to the latest release. Let me know if that works or if there's still issues.

@cjbassi
Copy link
Owner

cjbassi commented Apr 11, 2018

@petermbenjamin the panic you were getting should hopefully be fixed. Can you try the latest version to see what happens this time?

@pbnj
Copy link

pbnj commented Apr 11, 2018

@cjbassi - Indeed.
Tested by running:

$ go get -u -v github.com/cjbassi/gotop
$ gotop

And it doesn't crash or panic.

But, it's still taking about a minute before anything appears on the screen. I am not sure why.

Would you like me to open a separate GH issue for the slow startup time on macOS?
Also, any pointers/directions on troubleshooting/debugging this problem?

@cjbassi
Copy link
Owner

cjbassi commented Apr 11, 2018

@petermbenjamin Yah I think opening a new issue would be good.

I think the best way to debug the slow startup is to throw a bunch of fmt.Println("1"), fmt.Println("2"), etc into main.go and see where the program hangs for a while. If you're not familiar with Go I could create a branch with the print statements for you to test, just let me know.

@pbnj
Copy link

pbnj commented Apr 12, 2018 via email

@heliostatic
Copy link

Also on 10.12.6, clean install via

$ go get -u -v github.com/cjbassi/gotop
$ gotop

and this is the error I'm getting after about 45-60 seconds:

Error caught. Exiting program.

Issue with CPU percentages.

Diagnostics:
self.Count: 4
gopsutil.Counts(): 4
len(percents): 0
percents: []
self.interval: 1s

panic: 1

goroutine 19 [running]:
github.com/cjbassi/gotop/utils.Error(0x1183b16, 0xf, 0xc42017e060, 0x52)
	/home/cjbassi/go/src/github.com/cjbassi/gotop/utils/utils.go:30 +0x23f
github.com/cjbassi/gotop/widgets.(*CPU).update(0xc420092fa0)
	/home/cjbassi/go/src/github.com/cjbassi/gotop/widgets/cpu.go:55 +0x532
created by github.com/cjbassi/gotop/widgets.NewCPU
	/home/cjbassi/go/src/github.com/cjbassi/gotop/widgets/cpu.go:37 +0x2d3

@cjbassi
Copy link
Owner

cjbassi commented Apr 12, 2018

@heliostatic So the program runs and works for about 45 seconds and then gives that error?

The error is caused by gopsutil which I've already submitted an issue to, but it's good to get more info.

@heliostatic
Copy link

@cjbassi Good clarification--No, it sits at a blank terminal and then errors out.

@cjbassi cjbassi changed the title There is an error using on Mac Panic on Mac caused by cpu percentages issue Apr 12, 2018
@rkumar
Copy link

rkumar commented Apr 15, 2018

Getting this on OSX Sierra on both iTerm and Terminal. Nothing happens for half a minute, then I get this error. Installed using homebrew.

Error caught. Exiting program.

Issue with CPU percentages.

Diagnostics:
self.Count: 8
gopsutil.Counts(): 8
len(percents): 0
percents: []
self.interval: 1s

panic: 1

goroutine 17 [running]:
github.com/cjbassi/gotop/utils.Error(0x1184197, 0xf, 0xc4201ba060, 0x52)
/home/cjbassi/go/src/github.com/cjbassi/gotop/utils/utils.go:30 +0x23f
github.com/cjbassi/gotop/widgets.(*CPU).update(0xc420156000)
/home/cjbassi/go/src/github.com/cjbassi/gotop/widgets/cpu.go:57 +0x532
created by github.com/cjbassi/gotop/widgets.NewCPU
/home/cjbassi/go/src/github.com/cjbassi/gotop/widgets/cpu.go:38 +0x2d3

@stephencornelius
Copy link

I get the same issue as @rkumar when installing via brew but it works when installing via goget

@maxtar
Copy link

maxtar commented Apr 16, 2018

Have the same issue in Windows:


Issue with CPU percentages.

Diagnostics:
self.Count: 8
gopsutil.Counts(): 8
len(percents): 0
percents: []
self.interval: 1s

panic: 1

goroutine 17 [running]:
github.com/cjbassi/gotop/utils.Error(0x5a120a, 0xf, 0xc0421720c0, 0x52)
        d:/WLCR/GoProjects/src/github.com/cjbassi/gotop/utils/utils.go:30 +0x246
github.com/cjbassi/gotop/widgets.(*CPU).update(0xc042140000)
        d:/WLCR/GoProjects/src/github.com/cjbassi/gotop/widgets/cpu.go:57 +0x539
created by github.com/cjbassi/gotop/widgets.NewCPU
        d:/WLCR/GoProjects/src/github.com/cjbassi/gotop/widgets/cpu.go:38 +0x2da

Did by

$ go get -u -v github.com/cjbassi/gotop
$ gotop

@f1337
Copy link
Contributor

f1337 commented Apr 29, 2018

Worked for me, just now, with a 20-second startup delay (timed with stopwatch).go is installed via homebrew (brew install go). I compiled from source:

go get -u -v github.com/cjbassi/gotop
gotop

My system details:
macOS High Sierra 10.13.4
MacBook Pro (Retina, 15-inch, Mid 2015)
Processor: 2.5 GHz i7
Memory: 16 GB
Terminal: iTerm2 + fish shell + ohmyfish. no tmux.

@cjbassi
Copy link
Owner

cjbassi commented Apr 29, 2018

Thanks for all the info and sorry people have been having issues. It turns out gopsutil has some issues on OSX which makes gotop unusable on OSX right now. Hoping to fix that in the future, but I also don't have a mac to test on right now so help is appreciated. Going to close this issue and open another one that pools the issues people have been having on OSX.

@maxtar
Copy link

maxtar commented May 3, 2018

What about windows?

@cjbassi
Copy link
Owner

cjbassi commented May 3, 2018

@maxtar gotop is untested on windows but feel free to try it and let me know if it works or create an issue if it doesn't. I'd be happy to add support if people want it.

@maxtar
Copy link

maxtar commented May 3, 2018

@cjbassi As I mentioned here I've got the same issue. Need I creating new issue fro windows?

@cjbassi
Copy link
Owner

cjbassi commented May 3, 2018

@maxtar Oh sorry, I didn't see that you were having the same issue on windows. But yah actually if you create a new issue for that, that would be great. Thanks.

@maxtar
Copy link

maxtar commented May 3, 2018

@cjbassi Created :)

@cjbassi
Copy link
Owner

cjbassi commented May 24, 2018

gotop should be working on OSX now, and you can install using either Git, Homebrew, or from Source as documented in the readme. Let me know if you're still having any issues! Thanks @f1337 for helping get it to work!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.