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

runtime: compiled program makes cpu 100% in runtime #30382

Closed
hcj116 opened this issue Feb 25, 2019 · 11 comments
Closed

runtime: compiled program makes cpu 100% in runtime #30382

hcj116 opened this issue Feb 25, 2019 · 11 comments

Comments

@hcj116
Copy link

@hcj116 hcj116 commented Feb 25, 2019

  1. go version: go1.8~go1.11
  2. go env: windows amd64
  3. system env: windows 2016 Server + IIS(with 8 working processes)
  4. code:
package main
import "fmt"
func main(){
  fmt.println("hello, golang")
}
  1. build: go build -o hello.exe hello.go
  2. run hello.exe,it makes iis cpu reaches to 100%. but when the number of iis working processes is less than 4, everything is ok.
@martisch

This comment has been minimized.

Copy link
Member

@martisch martisch commented Feb 25, 2019

There seems to be a step missing between 5 and 6 as it is unclear (at least to me) how IIS is involved when executing the sample go program shown on Windows. Does just executing the hello.exe from command line on Windows result in 100% CPU?

If there are more steps involved please provide a complete reproduction. Note that the problem might not fall in the realm of the Go programming language.

@hcj116

This comment has been minimized.

Copy link
Author

@hcj116 hcj116 commented Feb 25, 2019

No more steps involved, in fact there is no any relations between hello.exe and IIS. But when I run hello.exe in command line, the cpu of IIS must reach to 100%, and when hello.exe exited, the cpu also restored to normalize.

@agnivade

This comment has been minimized.

Copy link
Contributor

@agnivade agnivade commented Feb 25, 2019

So you are essentially saying running process X makes process Y consume 100% CPU. I don't see any Go specific issue here as you have clearly mentioned there is no relation between hello.exe and IIS.

This may be an environment issue, or something else. I would suggest you to take a look at the Questions wiki page; it has a list of good places for asking questions such as these.

Note that the issue tracker is only used to track bugs/proposal in Go.

@bcmills

This comment has been minimized.

Copy link
Member

@bcmills bcmills commented Feb 25, 2019

Note that the example program doesn't even build: https://play.golang.org/p/B1ytJHfLAxs

If you believe that this is a bug in the Go runtime, then we need explicit steps that we can follow exactly to reproduce the problem. Given the lack of relationship between the two programs, I'm inclined to suspect that the bug lies elsewhere: for example, do you have an antivirus program running that may be consulting the IIS process to check for signatures matching hello.exe?

@bradfitz

This comment has been minimized.

Copy link
Member

@bradfitz bradfitz commented Feb 25, 2019

Maybe it's due to Go changing Windows' global timer resolution. (#28255)

@hcj116

This comment has been minimized.

Copy link
Author

@hcj116 hcj116 commented Mar 2, 2019

Maybe it's due to Go changing Windows' global timer resolution.

If it's true, how to fix it?

@bradfitz

This comment has been minimized.

Copy link
Member

@bradfitz bradfitz commented Mar 2, 2019

@hcj116, I suppose you could try doing something like this comment: #28255 (comment) and resetting it back to the system default.

@hcj116

This comment has been minimized.

Copy link
Author

@hcj116 hcj116 commented Apr 8, 2019

Yes, you're right. I encountered the same issue.

@hcj116

This comment has been minimized.

Copy link
Author

@hcj116 hcj116 commented Apr 8, 2019

When I unset the automatically synchronization with Internet time server, the system clock runs faster than usual.

@agnivade

This comment has been minimized.

Copy link
Contributor

@agnivade agnivade commented Apr 8, 2019

I would advise you to add your observations to that thread.

@andybons andybons changed the title Golang compiled program makes cpu 100% in runtime runtime: compiled program makes cpu 100% in runtime May 14, 2019
@andybons

This comment has been minimized.

Copy link
Member

@andybons andybons commented May 14, 2019

Duplicate of #28255

@andybons andybons marked this as a duplicate of #28255 May 14, 2019
@andybons andybons closed this May 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
7 participants
You can’t perform that action at this time.