Skip to content

test_logging: rollover tests fail on FreeBSD 16 #162515

Done

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 2026d, 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".

  8. hugovk commented on Nov 25, 2026

    @hugovk
    Member

    Yes, I meant 2026d, fixed above :)

  9. vstinner commented on Nov 25, 2026

    @vstinner
    MemberAuthor

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

    I commented the FreeBSD issue.

  10. vstinner commented on Nov 25, 2026

    @vstinner
    MemberAuthor

    Oh, it seems like FreeBSD 15 got updated: test_logging now also fails on FreeBSD 15 buildbot: https://buildbot.python.org/#/builders/2103/builds/397

    ======================================================================
    FAIL: test_compute_rollover_W6_local (test.test_logging.TimedRotatingFileHandlerTest.test_compute_rollover_W6_local)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/home/buildbot/buildarea/3.15.opsec-fbsd16/build/Lib/test/support/__init__.py", line 1217, in inner
        return func(*args, **kwds)
      File "/home/buildbot/buildarea/3.15.opsec-fbsd16/build/Lib/test/test_logging.py", line 7146, 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.15.opsec-fbsd16/build/Lib/test/test_logging.py", line 7141, 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.15.opsec-fbsd16/build/Lib/test/support/__init__.py", line 1217, in inner
        return func(*args, **kwds)
      File "/home/buildbot/buildarea/3.15.opsec-fbsd16/build/Lib/test/test_logging.py", line 7323, 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.15.opsec-fbsd16/build/Lib/test/test_logging.py", line 7318, in test
        self.assertEqual(diff, 0, datetime.timedelta(seconds=diff))
        ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    AssertionError: 172800.0 != 0 : 2 days, 0:00:00
  11. changed the title [-]test_logging: rollover tests fail on FreeBSD16[/-] [+]test_logging: rollover tests fail on FreeBSD[/+] on Nov 25, 2026
  12. hugovk commented on Nov 25, 2026

    @hugovk
    Member

    https://buildbot.python.org/#/builders/2103/builds/397 is FreeBSD 16: AMD64 FreeBSD16 3.15 builder on opsec-fbsd16 worker.

  13. vstinner commented on Nov 25, 2026

    @vstinner
    MemberAuthor

    Oh right! I was confused between Python 3.15 branch and FreeBSD 15 😁

  14. changed the title [-]test_logging: rollover tests fail on FreeBSD[/-] [+]test_logging: rollover tests fail on FreeBSD 16[/+] on Nov 25, 2026
  15. emaste commented on Nov 26, 2026

    @emaste
    Contributor

    I have a FreeBSD patch in review, waiting on feedback from upstream, FreeBSD's tzcode maintainer, or the release engineering team. We're tracking this issue for the 15.2 release.

  16. emaste commented on Nov 26, 2026

    @emaste
    Contributor

    @vstinner and everyone else thanks for digging into this and for comments in FreeBSD bug 300977. I have committed the patch from the review and will cherry-pick it soon. FreeBSD 15.2 will either have this change, or a variation if something different gets committed upstream to tzcode in time.

  17. vstinner commented on Nov 27, 2026

    @vstinner
    MemberAuthor

    @emaste: Sorry, I'm not used to the FreeBSD workflow. Does it mean that FreeBSD 16 will get an update soon with the fix?

  18. opsec commented on Nov 27, 2026

    @opsec

    https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=300977 has three (ups: four) commits: one to main, one to 15/stable and one to 15.2. 'main' maps to 16.0, so yes, it will receive it sooner or later. I'm not sure which package contains the fix and if that has already been rebuild. I just updated the py16 buildbot from the FreeBSD-base package repo and we'll see if the fix already made it into the packages.

  19. hugovk commented on Nov 27, 2026

    @hugovk
    Member

    I rebuilt "AMD64 FreeBSD16 3.x" and it passed now, thanks!

    https://buildbot.python.org/#/builders/1857/builds/1360

  20. hugovk commented on Nov 27, 2026

    @hugovk
    Member

    Oops, I just realised I forgot to attach my patch to my email to the tz mailing list :) Anyway, it was the same as @emaste's FreeBSD patch 👍

    Anyway, Paul Eggert has replied to the other email with another fix:

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

    Which is also committed: eggert/tz@9bbda32

    Slightly different, but works just as well.

  21. vstinner commented on Nov 27, 2026

    @vstinner
    MemberAuthor

    Since the Python buildbot is back to green, I close the issue.

    The bug is tracked in FreeBSD and tz bug tracker/mailing list anyway. Thanks everybody for that quick fix!

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