tomron opened a new issue, #4602:
URL: https://github.com/apache/iceberg-python/issues/4602

   `tests/io/test_content_cache.py::test_cache_expires_entries` (added in 
#4527) failed in the `windows-unit-test (3.12)` job on PR #4545:
   
   ```
   assert new_input.call_count == 2
   AssertionError: assert 1 == 2
   ```
   
   The test creates the cache with a 1 ms expiration, opens a file, calls 
`time.sleep(0.01)`, opens it again and expects a second `new_input` call. The 
cache is a `cachetools.TTLCache` using the default `time.monotonic` timer.
   
   On Python 3.12 on Windows, `time.monotonic` has a coarse resolution of about 
15.6 ms (this was only changed in 3.13, see python/cpython#116781 and 
python/cpython#88494). A 10 ms sleep can land in the same clock tick, so the 
entry does not expire. Simulating a clock quantized to 15.6 ms with the same 
TTL and sleep, the entry expired in only about 65% of 2000 trials, so roughly 
one run in three would fail.
   
   The same job passed on main and on another PR after #4527 merged, so it is 
intermittent. Suggested fix: use a fake or injectable clock in the test, as the 
earlier version did, or sleep for longer than the clock resolution.
   
   The PR that hit it, #4545, does not touch the cache code or tests/io. I 
haven't reproduced this on a real Windows runner.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to