Skip to content

test_timerfd_initval fails with large time difference on NetBSD #131266

Open

Description

@furkanonder

Bug report

Bug description:

The test_timerfd_initval test in test_os.TimerfdTests is failing on NetBSD with a very large time difference between the expected and actual expiration values. The test expects values to be almost equal within 3 decimal places, but the actual difference is over 1.7 billion seconds.

Configuration:

./configure --with-pydebug

Test

./python -m test test_os -m test_timerfd_initval -v

Output:

== CPython 3.14.0a6+ (heads/main:26511993e63, Mar 15 2025, 01:30:33) [GCC 10.5.0]
== NetBSD-10.0-amd64-x86_64-64bit-ELF little-endian
== Python build: debug
== cwd: /home/blue/cpython/build/test_python_worker_20567æ
== CPU count: 16
== encodings: locale=UTF-8 FS=utf-8
== resources: all test resources are disabled, use -u option to unskip tests
Using random seed: 3011250179
0:00:00 load avg: 2.25 Run 1 test sequentially in a single process
0:00:00 load avg: 2.25 [1/1] test_os
test_timerfd_initval (test.test_os.TimerfdTests.test_timerfd_initval) ... FAIL
======================================================================
FAIL: test_timerfd_initval (test.test_os.TimerfdTests.test_timerfd_initval)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/blue/cpython/Lib/test/test_os.py", line 4327, in test_timerfd_initval
    self.assertAlmostEqual(next_expiration, initial_expiration, places=self.CLOCK_RES_PLACES)
    ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: 1741991497.5326333 != 0.25 within 3 places (1741991497.2826333 difference)
----------------------------------------------------------------------
Ran 1 test in 0.010s
FAILED (failures=1)
test test_os failed
0:00:00 load avg: 2.25 [1/1/1] test_os failed (1 failure)
== Tests result: FAILURE ==
1 test failed:
    test_os
Total duration: 958 ms
Total tests: run=1 (filtered) failures=1
Total test files: run=1/1 (filtered) failed=1
Result: FAILURE

OS: NetBSD-10.0-amd64

CPython versions tested on:

CPython main branch, 3.14, 3.13

Operating systems tested on:

Other

Activity

  1. added
    3.13only security fixes
    3.14bugs and security fixes
    testsTests in the Lib/test dir
    type-bugAn unexpected behavior, bug, or error
    on Mar 14, 2025
  2. zware commented on Mar 15, 2025

    @zware
    Member

    As with gh-131263, this whole test class is supposed to be skipped on non-Linux platforms. In that framing, this could be closed as a duplicate.

  3. picnixz commented on Mar 23, 2025

    @picnixz
    Member

    I think we can even close it as a duplicate of #126112

  4. furkanonder commented on Apr 4, 2025

    @furkanonder
    ContributorAuthor

    I think we can even close it as a duplicate of #126112

    In addition, 3 more tests are failing. They are failing with error outputs different from those on Gentoo.

    ======================================================================
    FAIL: test_timerfd_TFD_TIMER_ABSTIME (test.test_os.TimerfdTests.test_timerfd_TFD_TIMER_ABSTIME)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/home/blue/Desktop/cpython/Lib/test/test_os.py", line 4425, in test_timerfd_TFD_TIMER_ABSTIME
        self.assertAlmostEqual(next_expiration, offset, places=self.CLOCK_RES_PLACES)
        ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    AssertionError: 1.003397717 != 1 within 3 places (0.0033977169999999113 difference)
    
    ======================================================================
    FAIL: test_timerfd_initval (test.test_os.TimerfdTests.test_timerfd_initval)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/home/blue/Desktop/cpython/Lib/test/test_os.py", line 4330, in test_timerfd_initval
        self.assertAlmostEqual(next_expiration, initial_expiration, places=self.CLOCK_RES_PLACES)
        ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    AssertionError: 1743795512.110591 != 0.25 within 3 places (1743795511.860591 difference)
    
    ======================================================================
    FAIL: test_timerfd_ns_select (test.test_os.TimerfdTests.test_timerfd_ns_select)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/home/blue/Desktop/cpython/Lib/test/test_os.py", line 4603, in test_timerfd_ns_select
        self.assertEqual((rfd, wfd, xfd), ([], [], []))
        ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    AssertionError: Tuples differ: ([], [3], []) != ([], [], [])
    
    First differing element 1:
    [3]
    []
    
    - ([], [3], [])
    ?       -
    
    + ([], [], [])
    
    ======================================================================
    FAIL: test_timerfd_select (test.test_os.TimerfdTests.test_timerfd_select)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/home/blue/Desktop/cpython/Lib/test/test_os.py", line 4438, in test_timerfd_select
        self.assertEqual((rfd, wfd, xfd), ([], [], []))
        ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    AssertionError: Tuples differ: ([], [3], []) != ([], [], [])
    
    First differing element 1:
    [3]
    []
    
    - ([], [3], [])
    ?       -
    
    + ([], [], [])
  5. StanFromIreland commented on Jun 27, 2025

    @StanFromIreland
    Member

    I think we can even close it as a duplicate of #126112

    I agree, the original issue here should is resolved with #135681 The other bugs mentioned are best discussed in the other issue.

  6. serhiy-storchaka commented on Jul 6, 2025

    @serhiy-storchaka
    Member

    It seems that on NetBSD, timerfd_settime() returns an absolute timer value instead of relative value. Although timerfd_gettime() returns a relative timer value. I think this is a NetBSD bug. This is Linux-specific API, but NetBSD implemented it for compatibility with Linux and failed at that detail.

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

    3.13only security fixes3.14bugs and security fixes3.15bugs and security fixesOS-netbsdtestsTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or error

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions