-
Notifications
You must be signed in to change notification settings - Fork 18k
runtime: inaccurate trace of GC time #19590
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
Comments
CC @aclements Do you have a test case that shows the problem more clearly? |
I can not get the codes, they are in my company. But I do separate the STW1, and can find the time cost in gcprocs. From the logic of the definition of gcprocs, it do have this danger of lock in sched.lock. sched.lock is a quite common lock. The test case I used starts thousands of goroutine and lots of channels. It's quite an extreme example, I do really find this delay in that case, but not find in other cases. Anyway, if the original version has no particular consideration in this sequence, I think putting the time recording below gcprocs is better. |
I'm more worried about the contention on sched.lock, actually. How long
were the delays you were seeing? Were there delays on every GC or just
some of them? How many goroutines did you have and how many were typically
runnable at the same time? What was GOMAXPROCS?
|
The delay was about several seconds. It's about several seconds, although it's 100 us normal. Just some of them, not always. My goroutines are about 100K. About the runnable goroutines are not checked. But most of them are waiting on channel for other goroutines give it message. GOMAXPROCS is 4. |
This case mainly occur on the force.g which is triggered by sysmon, I think this info is helpful for your consideration. |
CL https://golang.org/cl/49612 mentions this issue. |
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go 1.8
What operating system and processor architecture are you using (
go env
)?linux amd64
What did you do?
When I use gctrace to see the time cost in STW, I have some puzzles in the measurement of STW1.
I think
work.tMark - work.tSweepTerm
is the time of STW1. work.tSweepTerm is recorded as follows:I think this is not proper. Because functiom gcprocs has a sched.lock. So a loog time sleep may occur in this function. Actually I really find a long time cost in this function. In my examples, STW1 changed a lot. When I hack in code, I find that it cost in this lock. But this time should not be the time of STW1, because in this lock STW has not happened.
So the time cost in this lock should be added to STW1. The code should be changed to
The function gcprocs is below:
The text was updated successfully, but these errors were encountered: