Repository navigation
test_os.TimerfdTests is flaky #126112
Description
Activity
- addedtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
on Oct 29, 2024 I think this bug is similar to #124873 , though that one was on Android, while this one is on a (heavily-customized) Gentoo Linux.
Update:
Upgrading to 3.13.1 still resulted in a similar error:
====================================================================== FAIL: test_timerfd_TFD_TIMER_ABSTIME (test.test_os.TimerfdTests.test_timerfd_TFD_TIMER_ABSTIME) ---------------------------------------------------------------------- Traceback (most recent call last): File "/var/tmp/portage/dev-lang/python-3.13.1/work/Python-3.13.1/Lib/test/test_os.py", line 4266, in test_timerfd_TFD_TIMER_ABSTIME self.assertAlmostEqual(next_expiration, offset, places=self.CLOCK_RES_PLACES) ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AssertionError: 0.99945497 != 1 within 3 places (0.0005450299999999464 difference) ====================================================================== FAIL: test_timerfd_ns_poll (test.test_os.TimerfdTests.test_timerfd_ns_poll) ---------------------------------------------------------------------- Traceback (most recent call last): File "/var/tmp/portage/dev-lang/python-3.13.1/work/Python-3.13.1/Lib/test/test_os.py", line 4353, in test_timerfd_ns_poll self.check_timerfd_poll(True) ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^ File "/var/tmp/portage/dev-lang/python-3.13.1/work/Python-3.13.1/Lib/test/test_os.py", line 4338, in check_timerfd_poll self.assertEqual(self.read_count_signaled(fd), 1) ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AssertionError: 4 != 1 ---------------------------------------------------------------------- Ran 366 tests in 34.558s FAILED (failures=2, skipped=62) test test_os failedInteresting – I couldn't see how the test could fail this way unless the process had been suspended for 1/8 of a second. This seemed unlikely even on an Android emulator, but possible given Android's customized process scheduler. But if it's failing even on Linux, there's probably some other cause.
- changed the title
[-]test_os.TimerfdTests fail[/-][+]test_os.TimerfdTests fail on Gentoo[/+]on Dec 13, 2024 We've seen this in the Yocto Project when running the python tests inside a qemu on a heavily loaded system: https://bugzilla.yoctoproject.org/show_bug.cgi?id=15743.
The Yocto failure isn't in the same test, it's in a different timerfd test which is much more timing-sensitive. See discussion in #130508.
I notice that most of the timerfd tests create an FD and never close it. This shouldn't directly lead to the failure above, because every test uses a separate FD, but it would still be worth cleaning up.
FTR, it also failed on AMD Debian: #129797 (comment)
I saw this locally on Ubuntu 22.04 x86-64:
====================================================================== FAIL: test_timerfd_TFD_TIMER_ABSTIME (test.test_os.TimerfdTests.test_timerfd_TFD_TIMER_ABSTIME) ---------------------------------------------------------------------- Traceback (most recent call last): File "/raid/sgross/cpython/Lib/test/test_os.py", line 4419, in test_timerfd_TFD_TIMER_ABSTIME self.assertAlmostEqual(next_expiration, offset, places=self.CLOCK_RES_PLACES) ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AssertionError: 0.999380538 != 1 within 3 places (0.0006194619999999595 difference) ----------------------------------------------------------------------Reacted by Furkan Onder@colesbury It also fails on NetBSD, see #131266
- changed the title
[-]test_os.TimerfdTests fail on Gentoo[/-][+]test_os.TimerfdTests is flaky[/+]on Mar 14, 2025 test_time fails randomly on s390x Fedora Stable LTO + PGO 3.x.
Example: https://buildbot.python.org/#/builders/1627/builds/314
FAIL: test_timerfd_ns_poll (test.test_os.TimerfdTests.test_timerfd_ns_poll) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-s390x.lto-pgo/build/Lib/test/test_os.py", line 4512, in test_timerfd_ns_poll self.check_timerfd_poll(True) ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^ File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-s390x.lto-pgo/build/Lib/test/test_os.py", line 4497, in check_timerfd_poll self.assertEqual(self.read_count_signaled(fd), 1) ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AssertionError: 2 != 1This occurs every now and then on the 3.14 (which is weird, since it should also effect others) branch on ARM64 Raspbian buildbot:
====================================================================== FAIL: test_timerfd_interval (test.test_os.TimerfdTests.test_timerfd_interval) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/stan/buildarea/3.14.stan-raspbian.nondebug/build/Lib/test/test_os.py", line 4402, in test_timerfd_interval self.assertGreater(t, total_time - self.CLOCK_RES) ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AssertionError: 1.9921359503641725 not greater than 1.999====================================================================== FAIL: test_timerfd_initval (test.test_os.TimerfdTests.test_timerfd_initval) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/stan/buildarea/3.14.stan-raspbian.nondebug/build/Lib/test/test_os.py", line 4335, in test_timerfd_initval self.assertAlmostEqual(next_expiration, initial_expiration, places=self.CLOCK_RES_PLACES) ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AssertionError: 0.24579456700000002 != 0.25 within 3 places (0.004205432999999981 difference) ----------------------------------------------------------------------Maybe we should lower the default resolution to 2 places?
Maybe we should lower the default resolution to 2 places?
It makes sense. I wrote #135681 to do exactly that.
Reacted by Stan Ulbrych and Furkan Onder- marked
test_os.test_timerfd_initvalflaky test #118550 as a duplicate of this issueon Jun 24, 2026
Bug report
Bug description:
When compiling
dev-lang/python-3.13.0on Gentoo, the following tests failed:USEflags used are:which resulted in the following
./configureinvocation:CPython versions tested on:
3.13.0, 3.13.1
Operating systems tested on:
Linux (Gentoo)
Linked PRs