Skip to content

test_logging: rollover tests fail on FreeBSD16 #162515

Backlog

Description

@vstinner

Bug report

First failing build: https://buildbot.python.org/#/builders/1857/builds/1300

0:14:45 load avg: 2.62 mem:   91.0 MiB [1/1/1] test_logging failed (3 failures)
Re-running test_logging in verbose mode (matching: test_compute_rollover_W6_local, test_compute_rollover_W6_local_interval, test_rollover_delayed_dst)
test_compute_rollover_W6_local (test.test_logging.TimedRotatingFileHandlerTest.test_compute_rollover_W6_local) ... FAIL
Warning -- Unraisable exception
Exception ignored while finalizing file <_io.FileIO name='/tmp/test_python_fytgriaa/test_logging-2-p5zcq3ak.log' mode='ab' closefd=True>:
Traceback (most recent call last):
  File "/home/buildbot/buildarea/3.x.opsec-fbsd16/build/Lib/unittest/case.py", line 690, in run
    with outcome.testPartExecutor(self):
         ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
ResourceWarning: unclosed file <_io.TextIOWrapper name='/tmp/test_python_fytgriaa/test_logging-2-p5zcq3ak.log' mode='a' encoding='utf-8'>
test_compute_rollover_W6_local_interval (test.test_logging.TimedRotatingFileHandlerTest.test_compute_rollover_W6_local_interval) ... FAIL
Warning -- Unraisable exception
Exception ignored while finalizing file <_io.FileIO name='/tmp/test_python_fytgriaa/test_logging-2-7ie4uyl3.log' mode='ab' closefd=True>:
Traceback (most recent call last):
  File "/home/buildbot/buildarea/3.x.opsec-fbsd16/build/Lib/unittest/case.py", line 690, in run
    with outcome.testPartExecutor(self):
         ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
ResourceWarning: unclosed file <_io.TextIOWrapper name='/tmp/test_python_fytgriaa/test_logging-2-7ie4uyl3.log' mode='a' encoding='utf-8'>
test_rollover_delayed_dst (test.test_logging.TimedRotatingFileHandlerTest.test_rollover_delayed_dst) ... 
  test_rollover_delayed_dst (test.test_logging.TimedRotatingFileHandlerTest.test_rollover_delayed_dst) (when='W6', atTime=None, utc=False) ... FAIL

======================================================================
FAIL: test_compute_rollover_W6_local (test.est_logging.TimedRotatingFileHandlerTest.test_compute_rollover_W6_local)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/buildbot/buildarea/3.x.opsec-fbsd16/build/Lib/test/support/__init__.py", line 1256, in inner
    return func(*args, **kwds)
  File "/home/buildbot/buildarea/3.x.opsec-fbsd16/build/Lib/test/test_logging.py", line 7382, in test_compute_rollover_W6_local
    test(DT(2012, 3, 4, 23, 59, 59), DT(2012, 3, 5, 0, 0))
    ~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/buildbot/buildarea/3.x.opsec-fbsd16/build/Lib/test/test_logging.py", line 7377, in test
    self.assertEqual(diff, 0, datetime.timedelta(seconds=diff))
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: 172800.0 != 0 : 2 days, 0:00:00

======================================================================
FAIL: test_compute_rollover_W6_local_interval (test.test_logging.TimedRotatingFileHandlerTest.test_compute_rollover_W6_local_interval)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/buildbot/buildarea/3.x.opsec-fbsd16/build/Lib/test/support/__init__.py", line 1256, in inner
    return func(*args, **kwds)
  File "/home/buildbot/buildarea/3.x.opsec-fbsd16/build/Lib/test/test_logging.py", line 7559, in test_compute_rollover_W6_local_interval
    test(DT(2012, 2, 19, 23, 59, 59), DT(2012, 3, 5, 0, 0))
    ~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/buildbot/buildarea/3.x.opsec-fbsd16/build/Lib/test/test_logging.py", line 7554, in test
    self.assertEqual(diff, 0, datetime.timedelta(seconds=diff))
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: 172800.0 != 0 : 2 days, 0:00:00

======================================================================
FAIL: test_rollover_delayed_dst (test.test_logging.TimedRotatingFileHandlerTest.test_rollover_delayed_dst) (when='W6', atTime=None, utc=False)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/buildbot/buildarea/3.x.opsec-fbsd16/build/Lib/test/test_logging.py", line 6797, in test_rollover_delayed_dst
    self.assert_rollover_contents(
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        when, timestamps, expected, atTime=at_time, utc=utc)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/buildbot/buildarea/3.x.opsec-fbsd16/build/Lib/test/test_logging.py", line 6746, in assert_rollover_contents
    self.assertEqual(actual, expected)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
AssertionError: {'': ['1', '2'], '.2026-10-21': ['0']} != {'.2026-10-19': ['0'], '.2026-10-26': ['1'], '': ['2']}
- {'': ['1', '2'], '.2026-10-21': ['0']}
+ {'': ['2'], '.2026-10-19': ['0'], '.2026-10-26': ['1']}

----------------------------------------------------------------------
Ran 3 tests in 0.083s

FAILED (failures=3)
test test_logging failed
1 test failed again:
    test_logging

It seems like the FreeBSD 16 was upgraded in build 1300.

Significant differences on test.pythoninfo between build 1298 (success) and build 1300 (fail):

-lzma.LZMA_VERSION: 5.8.3
-lzma.lzma_version: 5.8.3
+lzma.LZMA_VERSION: 5.8.4
+lzma.lzma_version: 5.8.4

-os.uname: os.uname_result(sysname='FreeBSD', nodename='py16bb.opsec.eu', release='16.0-CURRENT', version='FreeBSD 16.0-CURRENT main-n287972-4c03feacd171 GENERIC', machine='amd64')
+os.uname: os.uname_result(sysname='FreeBSD', nodename='py16bb.opsec.eu', release='16.0-CURRENT', version='FreeBSD 16.0-CURRENT main-n291503-2cc3f14701c9 GENERIC', machine='amd64')

 resource.RLIMIT_KQUEUES: (9223372036854775807, 9223372036854775807)
-resource.RLIMIT_MEMLOCK: (65536, 65536)
+resource.RLIMIT_MEMLOCK: (262144, 262144)

-ssl.OPENSSL_API_VERSION_INFO: ssl.OPENSSL_VERSION_INFO(major=3, minor=5, fix=0, patch=7, status=0)
-ssl.OPENSSL_VERSION: OpenSSL 3.5.7 9 Jun 2026
-ssl.OPENSSL_VERSION_INFO: ssl.OPENSSL_VERSION_INFO(major=3, minor=5, fix=0, patch=7, status=0)
+ssl.OPENSSL_API_VERSION_INFO: ssl.OPENSSL_VERSION_INFO(major=3, minor=5, fix=0, patch=9, status=0)
+ssl.OPENSSL_VERSION: OpenSSL 3.5.9 29 Sep 2026
+ssl.OPENSSL_VERSION_INFO: ssl.OPENSSL_VERSION_INFO(major=3, minor=5, fix=0, patch=9, status=0)

-system.uptime: 16 days, 21:42:12
+system.uptime: 0:06:58

-zlib.ZLIB_VERSION: 1.3.2
-zlib.zlib_version: 1.3.2
+zlib.ZLIB_VERSION: 1.4
+zlib.zlib_version: 1.4

CPython versions tested on:

CPython main branch

Operating systems tested on:

Other

Activity

  1. added
    type-bug
    tests
    on Nov 23, 2026
  2. vstinner commented on Nov 24, 2026

    @vstinner
    MemberAuthor

    I can reproduce the issue on my FreeBSD 16 VM, but I cannot reproduce it on FreeBSD 15 VM nor on my FreeBSD 14 VM.

    Reproducer:

    import datetime
    import time
    import os
    
    os.environ['TZ'] = 'EST+05EDT,M3.2.0,M11.1.0'
    time.tzset()
    
    DT = datetime.datetime
    current = DT(2012, 2, 19, 23, 59, 59)
    currentTime = current.timestamp()
    week = 60 * 60 * 24 * 7  # seconds
    interval = week * 3
    result = currentTime + interval
    t = time.localtime(currentTime)
    print("localtime:", t)

    Output on Linux, FreeBSD 15 and FreeBSD 14: tm_wday=6

    localtime: time.struct_time(tm_year=2012, tm_mon=2, tm_mday=19, tm_hour=23, tm_min=59, tm_sec=59, tm_wday=6, tm_yday=50, tm_isdst=0)
    

    Output on FreeBSD 16: tm_wday=4

    localtime: time.struct_time(tm_year=2012, tm_mon=2, tm_mday=19, tm_hour=23, tm_min=59, tm_sec=59, tm_wday=4, tm_yday=50, tm_isdst=0)
    

    zoneinfo package version: result of pkg which /usr/share/zoneinfo/EST5EDT

    • FreeBSD 16: FreeBSD-zoneinfo-16.snap20261028145349
    • FreeBSD 15: FreeBSD-zoneinfo-15.1p7
  3. vstinner commented on Nov 24, 2026

    @vstinner
    MemberAuthor

    Ah, the issue affects all Python versions (test_logging fails at least on 3.14, 3.15 and main branches).

    On Fedora 45, /usr/share/zoneinfo/EST5EDT is provided by tzdata package which has the version tzdata-2026f-1.fc45.noarch or just "2026f" in short.

    For FreeBSD, I found https://www.freshports.org/misc/zoneinfo/ package but I'm not sure if it's the same as "FreeBSD-zoneinfo". Latest misc/zoneinfo update was at Nov 8th, 2026 (two weeks ago): "misc/zoneinfo: Update to 2026f" which points to https://data.iana.org/time-zones/tzdb/NEWS. This link describes "Release 2026f - 2026-10-27 23:16:49 -0700" as "Briefly: Cuba will not fall back 2026-11-01; stays on -04 through 2027-11-07. (...)".

    @opsec: Would you mind to have a look at this issue which only occurs on FreeBSD 16?

  4. vstinner commented on Nov 24, 2026

    @vstinner
    MemberAuthor

    test_compute_rollover_W6_local() was added in 2024 to test_logging by commit fee86fd of PR GH-116191:

    commit fee86fd9a422612b39e5aabf2571b8fe4abac770
    Author: Serhiy Storchaka <storchaka@gmail.com>
    Date:   Fri Mar 1 17:50:08 2024 +0200
    
        gh-88352: Fix logging.TimedRotatingFileHandler (GH-116191)
        
        * Do not overwrite already rolled over files. It happened at midnight or
          during the DST change and caused the loss of data.
        * computeRollover() now always return the timestamp larger than the
          specified time.
        * Fix computation of the rollover time during the DST change.
    

    test_rollover_delayed_dst() which also fails was added last month by commit 457ba33 of PR GH-160564:

    commit 457ba33e96e644b402ea83bd6079af264b192ffb
    Author: Liang Hu <35699841+LarryHu0217@users.noreply.github.com>
    Date:   Sat Oct 24 02:59:45 2026 -0400
    
        gh-160433: Correct timed log backup names across DST changes (GH-160564)
    
  5. changed the title [-]test_logging: rollover tests fail on AMD64 FreeBSD16 3.x buildbot[/-] [+]test_logging: rollover tests fail on FreeBSD16[/+] on Nov 24, 2026
  6. hugovk commented on Nov 24, 2026

    @hugovk
    Member

    This is a bug in tzcode 2026c, that is now in FreeBSD, and this buildbot has just been updated to include it.

    Here's a FreeBSD report: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=300977

    Perl also ran into it: Perl/perl5#25089

    I reported this to tzcode with a fix earlier:

    https://lists.iana.org/hyperkitty/list/tz@iana.org/thread/I7KQYKHBNCIC6FW7JMP4LPBPSECDKDE2/

    And as it happens, whilst my email was in moderation, an earlier mail in moderation posted the bug with a similar fix :)

    https://lists.iana.org/hyperkitty/list/tz@iana.org/thread/O3RZGBKSO5GXBFDZKW2JXO3OQIIGYBF3/

  7. vstinner commented on Nov 25, 2026

    @vstinner
    MemberAuthor

    Oh great! You went deeper into debugging than me! I failed to find the exact zoneinfo version on FreeBSD. It's not something like 2026 + letter.

    On Linux, I'm using 2026f but I'm not affected. Is it because localtime() has a different implementation on Linux glibc and on FreeBSD libc?

    This is a bug in tzcode 2026c

    I suppose that you mean 2026d. Your email says "2026c is good; 2026d- 2026f and main are bad".

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

    OS-freebsdteststype-bug

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions