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
time: TestOverflowRuntimeTimer fails on freebsd/amd64 #6874
Labels
Milestone
Comments
Very likely an artifact of virtualization. We should probably just bump up the timeout by default. Windows had to be special cased for the same reason. I should have listened to Rob when he suggested making the timeout very long "like a second" (https://golang.org/cl/9035047). |
I ran this test on real hardware in a loop and it failed. --- FAIL: TestOverflowRuntimeTimer (0.10 seconds) sleep_test.go:402: runtime timer stuck: overflow in addtimer FAIL FAIL time 7.448s I think the theory that the failures we have seen in CI is not correct. This is a real problem. Labels changed: added release-go1.3, removed priority-soon, release-none. |
Dave, Can you please apply https://golang.org/cl/58880043/ and run the tests for the time package? The log might be quite long so you might want to send it to golang-dev. Thanks. |
Hmm, I ran the test in a loop overnight and could not generate a failure. http://paste.ubuntu.com/6852101/ I don't know if this was due to the logging altering the timing issues in the test, or because I was not running the full test suite now (the additional output causes other tests to fail) |
Issue #6437 has been merged into this issue. |
I think I have an idea what is going wrong. Applying this diff diff -r d2e78612ed03 src/pkg/time/internal_test.go --- a/src/pkg/time/internal_test.go Fri Jan 31 17:43:46 2014 +1100 +++ b/src/pkg/time/internal_test.go Sat Feb 01 13:44:06 2014 +1100 @@ -70,6 +70,10 @@ // any more timers (they might hang due to the same bug we're // now testing). stop := Now().Add(timeout) + var count int + defer func() { + print("count "); println(count) + }() for { select { case <-t.C: @@ -78,6 +82,7 @@ if Now().After(stop) { return errors.New("runtime timer stuck: overflow in addtimer") } + count++ runtime.Gosched() } } Then observing the value of count deadwood(~/go/src/pkg/time) % while ./time.test ; do true ; done count 19 PASS count 18 PASS count 18 PASS We see that runtime.Gosched() does not yield to the timer goroutine immediately. However 18 iterations of the loop is sufficient to get the timer goroutine on the scheduler and send the value down t.C. However if the machine is loaded, as it will be by default when go test -short std runs, the results become unpredictable. ^Cdeadwood(~/go/src/pkg/time) % while ./time.test ; do true ; done count 614 PASS count 1 PASS count 860 PASS count 343 PASS count 2 I don't believe runtime.Gosched is yielding to the waiting goroutine. |
Owner changed to @davecheney. Status changed to Started. |
Here is a possible fix, https://golang.org/cl/56540046 |
This issue was closed by revision d98b3a7. Status changed to Fixed. |
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The text was updated successfully, but these errors were encountered: