NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kern/58914: timerfd_settime(2) is missing itimespecfix



The following reply was made to PR kern/58914; it has been noted by GNATS.

From: Thomas Klausner <wiz%NetBSD.org@localhost>
To: Taylor R Campbell <riastradh%NetBSD.org@localhost>
Cc: gnats-bugs%NetBSD.org@localhost
Subject: Re: kern/58914: timerfd_settime(2) is missing itimespecfix
Date: Wed, 18 Dec 2024 10:10:49 +0100

 On Wed, Dec 18, 2024 at 07:23:08AM +0000, Taylor R Campbell wrote:
 > Can you please try the attached patch?
 
 Thank you!  Before this, usually one run of the Python 3.13 test suite
 caused a panic. I've just finished three runs in a row without one.
 
 There's probably more to do in this corner of the code, since the
 Python self tests fail a lot:
 
 test_timerfd_TFD_TIMER_ABSTIME (test.test_os.TimerfdTests.test_timerfd_TFD_TIMER_ABSTIME) ... FAIL
 test_timerfd_initval (test.test_os.TimerfdTests.test_timerfd_initval) ... FAIL
 test_timerfd_interval (test.test_os.TimerfdTests.test_timerfd_interval) ... ok
 test_timerfd_negative (test.test_os.TimerfdTests.test_timerfd_negative) ...
   test_timerfd_negative (test.test_os.TimerfdTests.test_timerfd_negative) (flags=0, initial=-1, interval=0) ... FAIL
   test_timerfd_negative (test.test_os.TimerfdTests.test_timerfd_negative) (flags=1, initial=-1, interval=0) ... FAIL
   test_timerfd_negative (test.test_os.TimerfdTests.test_timerfd_negative) (flags=3, initial=-1, interval=0) ... FAIL
   test_timerfd_negative (test.test_os.TimerfdTests.test_timerfd_negative) (flags=0, initial=1, interval=-1) ... FAIL
   test_timerfd_negative (test.test_os.TimerfdTests.test_timerfd_negative) (flags=1, initial=1, interval=-1) ... FAIL
   test_timerfd_negative (test.test_os.TimerfdTests.test_timerfd_negative) (flags=3, initial=1, interval=-1) ... FAIL
   test_timerfd_negative (test.test_os.TimerfdTests.test_timerfd_negative) (flags=0, initial=-1, interval=-1) ... FAIL
   test_timerfd_negative (test.test_os.TimerfdTests.test_timerfd_negative) (flags=1, initial=-1, interval=-1) ... FAIL
   test_timerfd_negative (test.test_os.TimerfdTests.test_timerfd_negative) (flags=3, initial=-1, interval=-1) ... FAIL
   test_timerfd_negative (test.test_os.TimerfdTests.test_timerfd_negative) (flags=0, initial=-0.1, interval=0) ... FAIL
   test_timerfd_negative (test.test_os.TimerfdTests.test_timerfd_negative) (flags=1, initial=-0.1, interval=0) ... FAIL
   test_timerfd_negative (test.test_os.TimerfdTests.test_timerfd_negative) (flags=3, initial=-0.1, interval=0) ... FAIL
   test_timerfd_negative (test.test_os.TimerfdTests.test_timerfd_negative) (flags=0, initial=1, interval=-0.1) ... FAIL
   test_timerfd_negative (test.test_os.TimerfdTests.test_timerfd_negative) (flags=1, initial=1, interval=-0.1) ... FAIL
   test_timerfd_negative (test.test_os.TimerfdTests.test_timerfd_negative) (flags=3, initial=1, interval=-0.1) ... FAIL
   test_timerfd_negative (test.test_os.TimerfdTests.test_timerfd_negative) (flags=0, initial=-0.1, interval=-0.1) ... FAIL
   test_timerfd_negative (test.test_os.TimerfdTests.test_timerfd_negative) (flags=1, initial=-0.1, interval=-0.1) ... FAIL
   test_timerfd_negative (test.test_os.TimerfdTests.test_timerfd_negative) (flags=3, initial=-0.1, interval=-0.1) ... FAIL
 test_timerfd_non_blocking (test.test_os.TimerfdTests.test_timerfd_non_blocking) ... ok
 test_timerfd_ns_TFD_TIMER_ABSTIME (test.test_os.TimerfdTests.test_timerfd_ns_TFD_TIMER_ABSTIME) ... FAIL
 test_timerfd_ns_initval (test.test_os.TimerfdTests.test_timerfd_ns_initval) ... FAIL
 test_timerfd_ns_interval (test.test_os.TimerfdTests.test_timerfd_ns_interval) ... ok
 test_timerfd_ns_poll (test.test_os.TimerfdTests.test_timerfd_ns_poll) ... ok
 test_timerfd_ns_select (test.test_os.TimerfdTests.test_timerfd_ns_select) ... FAIL
 test_timerfd_poll (test.test_os.TimerfdTests.test_timerfd_poll) ... ok
 test_timerfd_select (test.test_os.TimerfdTests.test_timerfd_select) ... FAIL
 
 
 The code is in Lib/test/test_os.py in the Python sources.
 
 
 ======================================================================
 FAIL: test_timerfd_TFD_TIMER_ABSTIME (test.test_os.TimerfdTests.test_timerfd_TFD_TIMER_ABSTIME)
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File "/scratch/lang/python313/work/Python-3.13.1/Lib/test/test_os.py", line 4258, in test_timerfd_TFD_TIMER_ABSTIME
     self.assertAlmostEqual(next_expiration, offset, places=self.CLOCK_RES_PLACES)
     ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 AssertionError: 1.009601955 != 1 within 3 places (0.00960195499999994 difference)
 
 
 Probably fixable by saying we're like android - comment from the test code:
     # 1 ms accuracy is reliably achievable on every platform except Android
     # emulators, where we allow 10 ms (gh-108277).
 
 
 
 ======================================================================
 FAIL: test_timerfd_initval (test.test_os.TimerfdTests.test_timerfd_initval)
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File "/scratch/lang/python313/work/Python-3.13.1/Lib/test/test_os.py", line 4166, in test_timerfd_initval
     self.assertAlmostEqual(next_expiration, initial_expiration, places=self.CLOCK_RES_PLACES)
     ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 AssertionError: 1734508557.9747748 != 0.25 within 3 places (1734508557.7247748 difference)
 
 
 Problem with the return value?
 
 A lot fail because we return ETIMEDOUT instead of EINVAL:
 
 ======================================================================
 FAIL: test_timerfd_negative (test.test_os.TimerfdTests.test_timerfd_negative) (flags=0, initial=-1, interval=0)
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File "/scratch/lang/python313/work/Python-3.13.1/Lib/test/test_os.py", line 4205, in test_timerfd_negative
     self.assertEqual(context.exception.errno, errno.EINVAL)
     ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 AssertionError: 60 != 22
 
 ======================================================================
 FAIL: test_timerfd_negative (test.test_os.TimerfdTests.test_timerfd_negative) (flags=1, initial=-1, interval=0)
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File "/scratch/lang/python313/work/Python-3.13.1/Lib/test/test_os.py", line 4205, in test_timerfd_negative
     self.assertEqual(context.exception.errno, errno.EINVAL)
     ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 AssertionError: 60 != 22
 
 ======================================================================
 FAIL: test_timerfd_negative (test.test_os.TimerfdTests.test_timerfd_negative) (flags=3, initial=-1, interval=0)
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File "/scratch/lang/python313/work/Python-3.13.1/Lib/test/test_os.py", line 4205, in test_timerfd_negative
     self.assertEqual(context.exception.errno, errno.EINVAL)
     ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 AssertionError: 60 != 22
 
 ======================================================================
 FAIL: test_timerfd_negative (test.test_os.TimerfdTests.test_timerfd_negative) (flags=0, initial=1, interval=-1)
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File "/scratch/lang/python313/work/Python-3.13.1/Lib/test/test_os.py", line 4205, in test_timerfd_negative
     self.assertEqual(context.exception.errno, errno.EINVAL)
     ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 AssertionError: 60 != 22
 
 ======================================================================
 FAIL: test_timerfd_negative (test.test_os.TimerfdTests.test_timerfd_negative) (flags=1, initial=1, interval=-1)
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File "/scratch/lang/python313/work/Python-3.13.1/Lib/test/test_os.py", line 4205, in test_timerfd_negative
     self.assertEqual(context.exception.errno, errno.EINVAL)
     ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 AssertionError: 60 != 22
 
 ======================================================================
 FAIL: test_timerfd_negative (test.test_os.TimerfdTests.test_timerfd_negative) (flags=3, initial=1, interval=-1)
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File "/scratch/lang/python313/work/Python-3.13.1/Lib/test/test_os.py", line 4205, in test_timerfd_negative
     self.assertEqual(context.exception.errno, errno.EINVAL)
     ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 AssertionError: 60 != 22
 
 ======================================================================
 FAIL: test_timerfd_negative (test.test_os.TimerfdTests.test_timerfd_negative) (flags=0, initial=-1, interval=-1)
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File "/scratch/lang/python313/work/Python-3.13.1/Lib/test/test_os.py", line 4205, in test_timerfd_negative
     self.assertEqual(context.exception.errno, errno.EINVAL)
     ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 AssertionError: 60 != 22
 
 ======================================================================
 FAIL: test_timerfd_negative (test.test_os.TimerfdTests.test_timerfd_negative) (flags=1, initial=-1, interval=-1)
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File "/scratch/lang/python313/work/Python-3.13.1/Lib/test/test_os.py", line 4205, in test_timerfd_negative
     self.assertEqual(context.exception.errno, errno.EINVAL)
     ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 AssertionError: 60 != 22
 
 ======================================================================
 FAIL: test_timerfd_negative (test.test_os.TimerfdTests.test_timerfd_negative) (flags=3, initial=-1, interval=-1)
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File "/scratch/lang/python313/work/Python-3.13.1/Lib/test/test_os.py", line 4205, in test_timerfd_negative
     self.assertEqual(context.exception.errno, errno.EINVAL)
     ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 AssertionError: 60 != 22
 
 ======================================================================
 FAIL: test_timerfd_negative (test.test_os.TimerfdTests.test_timerfd_negative) (flags=0, initial=-0.1, interval=0)
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File "/scratch/lang/python313/work/Python-3.13.1/Lib/test/test_os.py", line 4205, in test_timerfd_negative
     self.assertEqual(context.exception.errno, errno.EINVAL)
     ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 AssertionError: 60 != 22
 
 ======================================================================
 FAIL: test_timerfd_negative (test.test_os.TimerfdTests.test_timerfd_negative) (flags=1, initial=-0.1, interval=0)
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File "/scratch/lang/python313/work/Python-3.13.1/Lib/test/test_os.py", line 4205, in test_timerfd_negative
     self.assertEqual(context.exception.errno, errno.EINVAL)
     ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 AssertionError: 60 != 22
 
 ======================================================================
 FAIL: test_timerfd_negative (test.test_os.TimerfdTests.test_timerfd_negative) (flags=3, initial=-0.1, interval=0)
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File "/scratch/lang/python313/work/Python-3.13.1/Lib/test/test_os.py", line 4205, in test_timerfd_negative
     self.assertEqual(context.exception.errno, errno.EINVAL)
     ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 AssertionError: 60 != 22
 
 ======================================================================
 FAIL: test_timerfd_negative (test.test_os.TimerfdTests.test_timerfd_negative) (flags=0, initial=1, interval=-0.1)
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File "/scratch/lang/python313/work/Python-3.13.1/Lib/test/test_os.py", line 4205, in test_timerfd_negative
     self.assertEqual(context.exception.errno, errno.EINVAL)
     ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 AssertionError: 60 != 22
 
 ======================================================================
 FAIL: test_timerfd_negative (test.test_os.TimerfdTests.test_timerfd_negative) (flags=1, initial=1, interval=-0.1)
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File "/scratch/lang/python313/work/Python-3.13.1/Lib/test/test_os.py", line 4205, in test_timerfd_negative
     self.assertEqual(context.exception.errno, errno.EINVAL)
     ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 AssertionError: 60 != 22
 
 ======================================================================
 FAIL: test_timerfd_negative (test.test_os.TimerfdTests.test_timerfd_negative) (flags=3, initial=1, interval=-0.1)
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File "/scratch/lang/python313/work/Python-3.13.1/Lib/test/test_os.py", line 4205, in test_timerfd_negative
     self.assertEqual(context.exception.errno, errno.EINVAL)
     ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 AssertionError: 60 != 22
 
 ======================================================================
 FAIL: test_timerfd_negative (test.test_os.TimerfdTests.test_timerfd_negative) (flags=0, initial=-0.1, interval=-0.1)
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File "/scratch/lang/python313/work/Python-3.13.1/Lib/test/test_os.py", line 4205, in test_timerfd_negative
     self.assertEqual(context.exception.errno, errno.EINVAL)
     ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 AssertionError: 60 != 22
 
 ======================================================================
 FAIL: test_timerfd_negative (test.test_os.TimerfdTests.test_timerfd_negative) (flags=1, initial=-0.1, interval=-0.1)
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File "/scratch/lang/python313/work/Python-3.13.1/Lib/test/test_os.py", line 4205, in test_timerfd_negative
     self.assertEqual(context.exception.errno, errno.EINVAL)
     ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 AssertionError: 60 != 22
 
 ======================================================================
 FAIL: test_timerfd_negative (test.test_os.TimerfdTests.test_timerfd_negative) (flags=3, initial=-0.1, interval=-0.1)
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File "/scratch/lang/python313/work/Python-3.13.1/Lib/test/test_os.py", line 4205, in test_timerfd_negative
     self.assertEqual(context.exception.errno, errno.EINVAL)
     ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 AssertionError: 60 != 22
 
 
 
 Not sure about the remaining ones:
 
 
 ======================================================================
 FAIL: test_timerfd_ns_TFD_TIMER_ABSTIME (test.test_os.TimerfdTests.test_timerfd_ns_TFD_TIMER_ABSTIME)
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File "/scratch/lang/python313/work/Python-3.13.1/Lib/test/test_os.py", line 4421, in test_timerfd_ns_TFD_TIMER_ABSTIME
     self.assertLess(abs(next_expiration_ns - offset_ns),  limit_error)
     ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 AssertionError: 1845710 not less than 1000000
 
 ======================================================================
 FAIL: test_timerfd_ns_initval (test.test_os.TimerfdTests.test_timerfd_ns_initval)
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File "/scratch/lang/python313/work/Python-3.13.1/Lib/test/test_os.py", line 4361, in test_timerfd_ns_initval
     self.assertEqual(interval_ns2, interval_ns)
     ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
 AssertionError: 10000000 != 1000000
 
 ======================================================================
 FAIL: test_timerfd_ns_select (test.test_os.TimerfdTests.test_timerfd_ns_select)
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File "/scratch/lang/python313/work/Python-3.13.1/Lib/test/test_os.py", line 4436, 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 "/scratch/lang/python313/work/Python-3.13.1/Lib/test/test_os.py", line 4271, in test_timerfd_select
     self.assertEqual((rfd, wfd, xfd), ([], [], []))
     ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 AssertionError: Tuples differ: ([], [3], []) != ([], [], [])
 
 First differing element 1:
 [3]
 []
 
 - ([], [3], [])
 ?       -
 
 + ([], [], [])
 
 ----------------------------------------------------------------------
 
 
 
 Thanks for the patch!
  Thomas
 


Home | Main Index | Thread Index | Old Index