Repository navigation
TimedRotatingFileHandler deletes wrong files #90221
Copy link
Copy link
Closed
Labels
3.10 (EOL)end of lifeend of life3.11only security fixesonly security fixes3.9 (EOL)end of lifeend of lifestdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Activity
SamiSalonen commented
on Dec 13, 2021 SamiSalonenmannequinMannequinAuthorMore actionshttps://bugs.python.org/issue45628 breaks file rotation.
I name my log files after module name, run the modules in separate processes, use the same log config in them, and store the log files in one common directory. For example, for modules
a.banda.b.cI have the following log files:a.b.log
a.b.c.logNow after bpo-45628 fix,
getFilesToDeletetreats the rotated log files from those modules the same, and deletes wrong files. IfbackupCountis set to e.g. 7, only total of 7 files are stored instead of 7 of each.- added3.9 (EOL)end of lifeend of life3.10 (EOL)end of lifeend of life3.11only security fixesonly security fixesstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
on Dec 13, 2021 SamiSalonen commented
on Dec 13, 2021 SamiSalonenmannequinMannequinAuthorMore actionsBreaking PR: #29310
% ./python.exe -We -m test -v test_logging -m test_compute_files_to_delete Raised RLIMIT_NOFILE: 256 -> 1024 == CPython 3.11.0a3+ (heads/main:9130a4d620, Dec 14 2021, 11:12:05) [Clang 13.0.0 (clang-1300.0.29.3)] == macOS-11.6-x86_64-i386-64bit little-endian == cwd: /Users/iritkatriel/src/cpython/build/test_python_86072æ == CPU count: 12 == encodings: locale=UTF-8, FS=utf-8 0:00:00 load avg: 5.20 Run tests sequentially 0:00:00 load avg: 5.20 [1/1] test_logging test_compute_files_to_delete (test.test_logging.TimedRotatingFileHandlerTest) ... Warning -- Unraisable exception Exception ignored in: <_io.FileIO name='/var/folders/kf/0v7kz3ps62dg11v9rq0sz35m0000gn/T/test_logging_w3nn9vsi/d.e.log' mode='ab' closefd=True> Traceback (most recent call last): File "/Users/iritkatriel/src/cpython/Lib/test/test_logging.py", line 5469, in test_compute_files_to_delete for i, prefix in enumerate(prefixes): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ResourceWarning: unclosed file <_io.TextIOWrapper name='/var/folders/kf/0v7kz3ps62dg11v9rq0sz35m0000gn/T/test_logging_w3nn9vsi/d.e.log' mode='a' encoding='UTF-8'> Warning -- Unraisable exception Exception ignored in: <_io.FileIO name='/var/folders/kf/0v7kz3ps62dg11v9rq0sz35m0000gn/T/test_logging_w3nn9vsi/a.b.c.log' mode='ab' closefd=True> Traceback (most recent call last): File "/Users/iritkatriel/src/cpython/Lib/test/test_logging.py", line 5469, in test_compute_files_to_delete for i, prefix in enumerate(prefixes): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ResourceWarning: unclosed file <_io.TextIOWrapper name='/var/folders/kf/0v7kz3ps62dg11v9rq0sz35m0000gn/T/test_logging_w3nn9vsi/a.b.c.log' mode='a' encoding='UTF-8'> Warning -- Unraisable exception Exception ignored in: <_io.FileIO name='/var/folders/kf/0v7kz3ps62dg11v9rq0sz35m0000gn/T/test_logging_w3nn9vsi/a.b.log' mode='ab' closefd=True> Traceback (most recent call last): File "/Users/iritkatriel/src/cpython/Lib/test/test_logging.py", line 5469, in test_compute_files_to_delete for i, prefix in enumerate(prefixes): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ResourceWarning: unclosed file <_io.TextIOWrapper name='/var/folders/kf/0v7kz3ps62dg11v9rq0sz35m0000gn/T/test_logging_w3nn9vsi/a.b.log' mode='a' encoding='UTF-8'> Warning -- Unraisable exception Exception ignored in: <_io.FileIO name='/var/folders/kf/0v7kz3ps62dg11v9rq0sz35m0000gn/T/test_logging_w3nn9vsi/d.e.f.log' mode='ab' closefd=True> Traceback (most recent call last): File "/Users/iritkatriel/src/cpython/Lib/test/test_logging.py", line 5469, in test_compute_files_to_delete for i, prefix in enumerate(prefixes): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ResourceWarning: unclosed file <_io.TextIOWrapper name='/var/folders/kf/0v7kz3ps62dg11v9rq0sz35m0000gn/T/test_logging_w3nn9vsi/d.e.f.log' mode='a' encoding='UTF-8'> ok
Ran 1 test in 0.016s
OK
test_logging failed (env changed)== Tests result: SUCCESS ==
1 test altered the execution environment:
test_loggingAh ... forgot to set delay=True for the handlers. Will look at this soon.
Metadata
Metadata
Assignees
Labels
3.10 (EOL)end of lifeend of life3.11only security fixesonly security fixes3.9 (EOL)end of lifeend of lifestdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields: