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
[2.7] test_weakref hangs on Python 2.7 on Windows #73982
Comments
See PR493 (https://ci.appveyor.com/project/python/cpython/build/2.7.13+.184) for an example. I'd rather not merge PR493, which adds AppVeyor to 2.7, until this is resolved. |
Another example (I checked, all tests are run except of test_weakref): ... command timed out: 1200 seconds without output, attempting to kill |
The problem are the 3 tests of test_weakref which uses collect_in_thread():
On my Linux with Python 2.7 compiled in debug mode, the two first tests take 1 second, but the last test takes 10 seconds. |
On Python 3, time.sleep(seconds) rounds seconds towards +Infinity: see bpo-22117, commot cb29f01. time.sleep(0.0001) sleeps 15.6 ms on Windows. On Python 2.7, time.sleep(seconds) rounds towards zero. time.sleep(0.0001) sleeps 0 ms on Windows, and so the collect_in_thread() thread calls gc.collect() in a sleep. |
@antoine: Another example of performance issue caused by rounding ;-) See also my article on pytime and timestamp rounding, https://haypo.github.io/pytime.html |
Another option is to change time.sleep() rounding, but it would impact all Python2 code using sleep()... I dislike this option. I expect many complains from users about such backward incompatible change in a minor |
I looked at test_weakref duration on buildbots before my change:
Hum. That's strange. I don't understand why sometimes test_weakref hangs, whereaas sometimes it pass in less than 60 seconds? |
Oh wow! The commit 1fef015 fixed PGO compilation on Python 2.7: http://buildbot.python.org/all/builders/AMD64%20Debian%20PGO%202.7/builds/227 is the first successful build since June 20. I didn't notice that the PGO buildbot was also stuck in running test_weakref in the compile step: job killed after 30 min. command timed out: 1200 seconds without output running ['make', 'all'], attempting to kill While build 206 was green, the buildbot started to fail in build 207: http://buildbot.python.org/all/builders/AMD64%20Debian%20PGO%202.7/builds/207 The strange thing is that this change only contains two small changes: I fail to understand how these changes make test_weakref hangs. Well, at least the good news is that it's now fixed ;-) |
With commit 1fef015, test_weakref takes 11 seconds on my Windows VM. Without this fix, test_weakref runs for longer than 2 hour and 19 min on my Windows VM. I decided to kill the test, I don't want to burn my CPU too long :-) So at least, on my Windows VM, the bug is trivial to reproduce! |
Looks like we forgot to close this one; as far as I can tell it was fixed. Being 2.7-only, it's time to be closed anyway :) |
Yep, I didn't see any test_weakref hang anymore since this commit. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: