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

Crazy CPU usage on Mac (edit: also inside Docker container) #39

Open
fishnux opened this issue Apr 5, 2019 · 5 comments
Open

Crazy CPU usage on Mac (edit: also inside Docker container) #39

fishnux opened this issue Apr 5, 2019 · 5 comments
Labels
bug Something isn't working

Comments

@fishnux
Copy link

fishnux commented Apr 5, 2019

Hi,

I'm trying godev for the first time. It looks like the godev process is generating an astounding load on the CPU (over 1.00). I wonder if you have an infinite loop somewhere?

Edit: Also happens inside a Docker container

@fishnux fishnux changed the title Crazy CPU usage on Mac Crazy CPU usage on Mac (edit: also inside Docker container) Apr 6, 2019
@crabmusket
Copy link

I've just started running godev through Docker (using the zephinzer/godev:go-1.12 image) and I am seeing the same thing!

@zephinzer
Copy link
Owner

Thanks for the report! I will look into this-

@zephinzer zephinzer added the bug Something isn't working label Apr 16, 2019
@zephinzer
Copy link
Owner

Seems like there's a channel leak at handleStart, after doing 4 live-reloads, the following appears in the profiling:

goroutine profile: total 17
5 @ 0x42d72b 0x42d7d3 0x404e0d 0x404be5 0x753473 0x45ab61
#	0x753472	main.(*Command).handleStart+0x62	/REDACTED/godev/command.go:220

@crabmusket
Copy link

crabmusket commented May 10, 2019

I previously wrote some code to watch files in a similar manner, and found it burned CPU like this, until I added a sleep to each watch loop. I tried doing so in all the loops I could find, but it didn't seem to reduce the CPU usage :/

EDIT: there are actually several more for { loops than the one that I added to in that commit. I thought I'd fixed all of them - maybe I never committed those changes. But you get the idea.

@zephinzer
Copy link
Owner

Thanks for investigating @crabmusket, I’m seeing if I can rewrite some parts to use channels in a more “go” way, realised I may have done some things wrongly after attending a workshop that covers these sort of things!

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

No branches or pull requests

3 participants