GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — test_os.TimerfdTests is flaky · Issue #126112 · python/cpython

test_os.TimerfdTests is flaky #126112

New issue
Copy link
New issue
Copy link
Closed
Closed
test_os.TimerfdTests is flaky#126112
Copy link
Labels
testsTests in the Lib/test dirTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@pepoluan
pepoluan
opened on Oct 29, 2024
Issue body actions

Bug report

Bug description:

When compiling dev-lang/python-3.13.0 on Gentoo, the following tests failed:

======================================================================
FAIL: test_timerfd_interval (test.test_os.TimerfdTests.test_timerfd_interval)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/var/tmp/portage/dev-lang/python-3.13.0/work/Python-3.13.0/Lib/test/test_os.py", line 4238, in test_timerfd_interval
    self.assertEqual(self.read_count_signaled(fd), 1)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: 4 != 1

======================================================================
FAIL: test_timerfd_ns_select (test.test_os.TimerfdTests.test_timerfd_ns_select)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/var/tmp/portage/dev-lang/python-3.13.0/work/Python-3.13.0/Lib/test/test_os.py", line 4457, in test_timerfd_ns_select
    self.assertEqual(self.read_count_signaled(fd), 1)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: 2 != 1

======================================================================
FAIL: test_timerfd_poll (test.test_os.TimerfdTests.test_timerfd_poll)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/var/tmp/portage/dev-lang/python-3.13.0/work/Python-3.13.0/Lib/test/test_os.py", line 4349, in test_timerfd_poll
    self.check_timerfd_poll(False)
    ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^
  File "/var/tmp/portage/dev-lang/python-3.13.0/work/Python-3.13.0/Lib/test/test_os.py", line 4337, in check_timerfd_poll
    self.assertEqual(self.read_count_signaled(fd), 1)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: 2 != 1

======================================================================
FAIL: test_timerfd_select (test.test_os.TimerfdTests.test_timerfd_select)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/var/tmp/portage/dev-lang/python-3.13.0/work/Python-3.13.0/Lib/test/test_os.py", line 4292, in test_timerfd_select
    self.assertEqual(self.read_count_signaled(fd), 1)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: 5 != 1

----------------------------------------------------------------------
Ran 366 tests in 32.208s

FAILED (failures=4, skipped=62)
test test_os failed

USE flags used are:

USE="ensurepip gdbm ncurses pgo readline sqlite ssl -bluetooth -build -debug -examples (-jit) -libedit* -test -tk -valgrind -verify-sig"

which resulted in the following ./configure invocation:

./configure --prefix=/usr --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc --localstatedir=/var/lib --datarootdir=/usr/share --docdir=/usr/share/doc/python-3.13.0 --htmldir=/usr/share/doc/python-3.13.0/html --libdir=/usr/lib64 ac_cv_header_stropts_h=no --enable-shared --without-static-libpython --enable-ipv6 --infodir=${prefix}/share/info --mandir=${prefix}/share/man --with-computed-gotos --with-dbmliborder=gdbm --with-libc= --enable-loadable-sqlite-extensions --without-ensurepip --without-lto --with-system-expat --with-system-libmpdec --with-platlibdir=lib --with-pkg-config=yes --with-wheel-pkg-dir=/usr/lib/python/ensurepip --enable-gil --without-assertions --disable-experimental-jit --enable-optimizations --with-readline=readline --without-valgrind --with-lto

CPython versions tested on:

3.13.0, 3.13.1

Operating systems tested on:

Linux (Gentoo)

Linked PRs

  • gh-126112: Fix test_os.TimerfdTests: use 10 ms resolution #135681
  • [3.14] gh-126112: Fix test_os.TimerfdTests: use 10 ms resolution (GH-135681) #135704
  • [3.13] gh-126112: Fix test_os.TimerfdTests: use 10 ms resolution (GH-135681) #135705

Activity

  1. pepoluan
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    on Oct 29, 2024
  2. picnixz
    added
    testsTests in the Lib/test dirTests in the Lib/test dir
    on Oct 29, 2024
  3. pepoluan commented on Dec 13, 2024

    @pepoluan
    pepoluan
    on Dec 13, 2024
    ContributorAuthor
    More actions

    I think this bug is similar to #124873 , though that one was on Android, while this one is on a (heavily-customized) Gentoo Linux.

  4. pepoluan commented on Dec 13, 2024

    @pepoluan
    pepoluan
    on Dec 13, 2024
    ContributorAuthor
    More actions

    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 failed
    
  5. mhsmith commented on Dec 13, 2024

    @mhsmith
    mhsmith
    on Dec 13, 2024
    Member
    More actions

    Interesting – 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.

  6. mhsmith
    changed the title [-]test_os.TimerfdTests fail[/-] [+]test_os.TimerfdTests fail on Gentoo[/+] on Dec 13, 2024
  7. rossburton commented on Feb 24, 2025

    @rossburton
    rossburton
    on Feb 24, 2025
    Contributor
    More actions

    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.

  8. mhsmith commented on Feb 24, 2025

    @mhsmith
    mhsmith
    on Feb 24, 2025
    Member
    More actions

    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.

  9. mhsmith commented on Feb 24, 2025

    @mhsmith
    mhsmith
    on Feb 24, 2025
    Member
    More actions

    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.

  10. picnixz commented on Feb 25, 2025

    @picnixz
    picnixz
    on Feb 25, 2025
    Member
    More actions

    FTR, it also failed on AMD Debian: #129797 (comment)

  11. colesbury commented on Mar 12, 2025

    @colesbury
    colesbury
    on Mar 12, 2025
    Contributor
    More actions

    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
  12. furkanonder commented on Mar 14, 2025

    @furkanonder
    furkanonder
    on Mar 14, 2025
    Contributor
    More actions

    @colesbury It also fails on NetBSD, see #131266

  13. picnixz
    changed the title [-]test_os.TimerfdTests fail on Gentoo[/-] [+]test_os.TimerfdTests is flaky[/+] on Mar 14, 2025
  14. vstinner commented on May 1, 2025

    @vstinner
    vstinner
    on May 1, 2025
    Member
    More actions

    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 != 1
    
  15. StanFromIreland commented on Jun 18, 2025

    @StanFromIreland
    StanFromIreland
    on Jun 18, 2025
    Member
    More actions

    This occurs every now and then on the 3.14 (which is weird, since it should also effect others) branch on ARM64 Raspbian buildbot:

    full log

    ======================================================================
    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
    

    full log

    ======================================================================
    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?

  16. vstinner
    added 2 commits that reference this issue on Jun 18, 2025

    pythongh-126112: Fix test_os.TimerfdTests: use 10 ms

    e4deaaf

    pythongh-126112: Fix test_os.TimerfdTests: use 10 ms resolution

    aaac3f4
  17. vstinner commented on Jun 18, 2025

    @vstinner
    vstinner
    on Jun 18, 2025
    Member
    More actions

    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
  18. vstinner
    added a commit that references this issue on Jun 19, 2025

    gh-126112: Fix test_os.TimerfdTests: use 10 ms resolution (#135681)

    5c25c88
  19. miss-islington
    added 2 commits that reference this issue on Jun 19, 2025

    pythongh-126112: Fix test_os.TimerfdTests: use 10 ms resolution (pyth…

    4f32c2c

    pythongh-126112: Fix test_os.TimerfdTests: use 10 ms resolution (pyth…

    5b29b9d
  20. vstinner
    added 2 commits that reference this issue on Jun 19, 2025

    [3.13] gh-126112: Fix test_os.TimerfdTests: use 10 ms resolution (GH-…

    55a34a1

    [3.14] gh-126112: Fix test_os.TimerfdTests: use 10 ms resolution (GH-…

    53b36e0
  21. lkollar
    added a commit that references this issue on Jun 19, 2025

    pythongh-126112: Fix test_os.TimerfdTests: use 10 ms resolution (pyth…

    9cb0a45
  22. Pranjal095
    added a commit that references this issue on Jul 12, 2025

    pythongh-126112: Fix test_os.TimerfdTests: use 10 ms resolution (pyth…

    7f6760b
  23. taegyunkim
    added a commit that references this issue on Aug 4, 2025

    pythongh-126112: Fix test_os.TimerfdTests: use 10 ms resolution (pyth…

    f46c75c
  24. hugovk
    closed this as completedon Aug 15, 2025
  25. Agent-Hellboy
    added a commit that references this issue on Aug 19, 2025

    pythongh-126112: Fix test_os.TimerfdTests: use 10 ms resolution (pyth…

    f9801d3
  26. StanFromIreland
    marked test_os.test_timerfd_initval flaky test #118550 as a duplicate of this issue on Jun 24, 2026
  27. hugovk
    marked test_timerfd_initval fails with large time difference on NetBSD #131266 as a duplicate of this issue on Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    testsTests in the Lib/test dirTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402520 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.