-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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: loops forever on sched_yield sometimes(timer related) #38023
Comments
/cc @aclements |
@xtaci Thanks for opening the issue. I also have the same problem but only tested on VirtualBox. Here is my report previously on golang-nuts: https://groups.google.com/forum/#!topic/golang-nuts/np70gmtKsaM . Long story short, I have five services run on VirtualBox using Linux as guest machine and macOS as host machine. Sometimes one service will run with high CPU, sometimes two. My go version,
Debugging with gdb result in the following list of threads,
According to my bisections (third times), the following commit cause it,
Link to CL: https://go-review.googlesource.com/c/go/+/221077 I try to debug it manually and run gdb with it,
It print the following line for the service with high CPU,
I hope that give some light, because I did not have a minimal reproducible code. CC: @ianlancetaylor |
Is there a way that we can recreate the problem? |
I still don't understand how this could happen, but I can see how to reduce the length of time that the |
Change https://golang.org/cl/224902 mentions this issue: |
It seems that sched_yield() does not block under some circumtances, so the for loop in time.go runs forever. And yes, this appears on KVM based virtual machine, both vultr and promox-ve. |
Is it possible for you to test whether the patch above helps with the problem? Thanks. |
ok, I'll try to apply time.go with that patch |
@ianlancetaylor my program works successfully for the last 8hrs, good job! gonna check to see if it works for the next 24hrs. |
@ianlancetaylor after couple of hours, there are no more high CPUs on services in VirtualBox. Seems the CL works. |
@ianlancetaylor can you adjust the plan and apply this patch to 1.14.2? |
@gopherbot Please open backport issue for 1.14. This problem can cause Go programs to hang in some circumstances, with no workaround. |
Backport issue(s) opened: #38051 (for 1.14). Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://golang.org/wiki/MinorReleases. |
Change https://golang.org/cl/225277 mentions this issue: |
successfuly ran for 24hrs! |
…rModifying Reduce the length of time that other timer functions can see timerModifying. In particular avoid system calls. For #38023 Fixes #38051 Change-Id: I1b61229c668e6085d9ee6dca9488a90055386c36 Reviewed-on: https://go-review.googlesource.com/c/go/+/224902 Run-TryBot: Ian Lance Taylor <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Michael Knyszek <[email protected]> (cherry picked from commit 355f53f) Reviewed-on: https://go-review.googlesource.com/c/go/+/225277
This contains a patch fix for golang/go#38023 which have been encountered in our load tests and some users. I have verified on such a stuck instance and the thread dump seem to match with what is seen on the issue. All threads stuck on runtime.futex, except one, which is at runtime.osyield. And of all the times load tests were run which _did not_ show this issue, it was run with a version greater than 1.14.1, which further points to the theory that this bug is the culprit.
* MM-26584: Bump up Go patch version This contains a patch fix for golang/go#38023 which have been encountered in our load tests and some users. I have verified on such a stuck instance and the thread dump seem to match with what is seen on the issue. All threads stuck on runtime.futex, except one, which is at runtime.osyield. And of all the times load tests were run which _did not_ show this issue, it was run with a version greater than 1.14.1, which further points to the theory that this bug is the culprit. * Replace docker image versions. * Update build/README.md Co-authored-by: Elisabeth Kulzer <[email protected]> Co-authored-by: Mattermod <[email protected]>
* MM-26584: Bump up Go patch version (#15156) * MM-26584: Bump up Go patch version This contains a patch fix for golang/go#38023 which have been encountered in our load tests and some users. I have verified on such a stuck instance and the thread dump seem to match with what is seen on the issue. All threads stuck on runtime.futex, except one, which is at runtime.osyield. And of all the times load tests were run which _did not_ show this issue, it was run with a version greater than 1.14.1, which further points to the theory that this bug is the culprit. * Replace docker image versions. * Update build/README.md Co-authored-by: Elisabeth Kulzer <[email protected]> Co-authored-by: Mattermod <[email protected]> * Trigger CI Co-authored-by: Elisabeth Kulzer <[email protected]> Co-authored-by: Mattermod <[email protected]>
* MM-26584: Bump up Go patch version This contains a patch fix for golang/go#38023 which have been encountered in our load tests and some users. I have verified on such a stuck instance and the thread dump seem to match with what is seen on the issue. All threads stuck on runtime.futex, except one, which is at runtime.osyield. And of all the times load tests were run which _did not_ show this issue, it was run with a version greater than 1.14.1, which further points to the theory that this bug is the culprit. * Replace docker image versions. * Update build/README.md Co-authored-by: Elisabeth Kulzer <[email protected]> Co-authored-by: Mattermod <[email protected]>
* MM-26584: Bump up Go patch version This contains a patch fix for golang/go#38023 which have been encountered in our load tests and some users. I have verified on such a stuck instance and the thread dump seem to match with what is seen on the issue. All threads stuck on runtime.futex, except one, which is at runtime.osyield. And of all the times load tests were run which _did not_ show this issue, it was run with a version greater than 1.14.1, which further points to the theory that this bug is the culprit. * Replace docker image versions. * Update build/README.md ```release-note Bumped up the Go patch version which contains a fix in the Go runtime due to which the Mattermost server would get stuck randomly. ``` Co-authored-by: Elisabeth Kulzer <[email protected]> Co-authored-by: Mattermod <[email protected]>
* MM-26584: Bump up Go patch version This contains a patch fix for golang/go#38023 which have been encountered in our load tests and some users. I have verified on such a stuck instance and the thread dump seem to match with what is seen on the issue. All threads stuck on runtime.futex, except one, which is at runtime.osyield. And of all the times load tests were run which _did not_ show this issue, it was run with a version greater than 1.14.1, which further points to the theory that this bug is the culprit. * Replace docker image versions. * Update build/README.md ```release-note Bumped up the Go patch version which contains a fix in the Go runtime due to which the Mattermost server would get stuck randomly. ``` Co-authored-by: Elisabeth Kulzer <[email protected]> Co-authored-by: Mattermod <[email protected]> Co-authored-by: Elisabeth Kulzer <[email protected]> Co-authored-by: Mattermod <[email protected]>
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
a program ran for some unkown time(minutes to hours), then CPU goes to 100% and never back to normal.
What did you expect to see?
normal CPU usage
What did you see instead?
100% CPU usage for a single core, I use delve to attach to the process, and other goroutines are blocking on events forever, including some time.Tickers which expected to fire periodically.(I put breakpoints on first lines of timer handlers.)
also strace shows it call sched_yield() infinitely
with 100% CPU usage
program build flag:
env CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build ...
/usr/local/go/src/runtime/time.go
The text was updated successfully, but these errors were encountered: