-
-
Notifications
You must be signed in to change notification settings - Fork 31.2k
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
[Windows] test_int.test_denial_of_service failed: took 15ms #114911
Comments
A few of our tests measure the time of CPU-bound operation, mainly to avoid quadratic or worse behaviour. Add a helper to ignore GC and time spent in other processes.
The problem here is that time.monotonic() has a resolution of 15.6 ms on Windows. It can return 0 or 15.6 ms for short timing, nothing in between. I added "CLOCK_RES" to some tests:
|
I don't know if it's the root issue or not. I will try to reproduce to debug the issue on Windows. |
Hm, this is using |
Happened again: #115504 (comment) |
A few of our tests measure the time of CPU-bound operation, mainly to avoid quadratic or worse behaviour. Add a helper to ignore GC and time spent in other processes.
A few of our tests measure the time of CPU-bound operation, mainly to avoid quadratic or worse behaviour. Add a helper to ignore GC and time spent in other processes.
A few of our tests measure the time of CPU-bound operation, mainly to avoid quadratic or worse behaviour. Add a helper to ignore GC and time spent in other processes.
A few of our tests measure the time of CPU-bound operation, mainly to avoid quadratic or worse behaviour. Add a helper to ignore GC and time spent in other processes.
@terryjreedy, do you see this on a machine where you could test a fix? |
I observed 2 failures in about 18 tries on installed 3.13.0 no-debug gil. I could hand-patch (copy-patch) a bit of test_int. On fairly fresh local debug no-gil build I got 0 failures in 40 tries. Easy to patch from PR, but need something that fails to test fix. |
I changed time.monotonic() in Python 3.13 to use QueryPerformanceCounter(). It now has a resolution better than 1 microsecond. |
Like @eryksun mentioned there, the "real" resolution is 15.625 ms by default, hence the On my PC
Exactly this happens in very rare cases for sw_fail_huge.seconds or sw_fail_extra_huge.seconds even though they are only 2 to 4 microseconds wall time on my PC. Almost always this results in If we fix the reported resolution of
This would fix Windows and other OSs having such poor resolution for
But then |
test_int
recently failed on a buildbot:I don't know for sure, but my guess is that a GC collection got triggered at the wrong time.
I'd like to add a test helper for timing CPU-bound tasks. It should disable GC and use
process_time
; perhaps it can do other tricks in the future too.Linked PRs
The text was updated successfully, but these errors were encountered: