warnings bookkeeping: count warning codes instead of keeping the warnings - #10331
Open
ThomasWaldmann wants to merge 1 commit into
Open
warnings bookkeeping: count warning codes instead of keeping the warnings#10331ThomasWaldmann wants to merge 1 commit into
ThomasWaldmann wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #10331 +/- ##
==========================================
+ Coverage 87.72% 87.75% +0.02%
==========================================
Files 103 103
Lines 18816 18810 -6
Branches 2904 2905 +1
==========================================
- Hits 16507 16506 -1
+ Misses 1605 1601 -4
+ Partials 704 703 -1 ☔ View full report in Codecov by Harness. |
…ings add_warning() stored the message, its args and the formatting style of every warning emitted during a borg run in a global list, but all that is ever read back from it is the set of warning codes (get_ec() computes the final exit code from that). For a BackupWarning, the args include the caught exception, and an exception references its traceback and thus the frames (with all their locals) of the code that failed - so every warning about a failed file kept e.g. the extract_item frame including the chunk data that was being written alive for the rest of the run. borg extract of 300 files of 2.5 MB whose writes all fail peaked at 876 MiB RSS instead of 409 MiB, and on a full disk every remaining file adds another chunk. Keep only a Counter of warning codes: add_warning() takes just the code, init_ec_warnings() loses its unused warnings list parameter, get_ec() logs the per-code counts at debug level. Add a regression test (the exception wrapped by a BackupWarning must be freed after print_warning_instance()) and a unit test for the get_ec() warnings logic. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
ThomasWaldmann
force-pushed
the
warnings-no-retain
branch
from
September 6, 2026 14:02
6717775 to
ff8b5ba
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
add_warning()stored the message, its args and the formatting style of every warning emitted during a borg run in a global list, but all that is ever read back from it is the set of warning codes (get_ec()computes the final exit code from that).For a
BackupWarning, the args include the caught exception, and an exception references its traceback and thus the frames (with all their locals) of the code that failed. So every warning about a failed file kept e.g. theextract_item()frame - including the chunkdatathat was being written - alive for the rest of the run. On a full disk, every remaining file adds another chunk.Measured with
borg extractof 300 files of 2.5 MB whose writes all fail (ulimit -f, so each write gets EFBIG):How
Counterof warning codes;add_warning()takes just the codeinit_ec_warnings()drops its never-usedwarningsparameterget_ec()logs the per-code counts at debug levelprint_warning()passes only the codeTests
print_warning_instance()level: the exception wrapped by theBackupWarningmust be freed afterwards (checked via weakref). Fails on master, passes here.get_ec()warnings logic (one kind of warning, mixed kinds, error precedence, reset)Note:
1.4-mainthas the same bookkeeping inhelpers/__init__.py, so the same fix applies there.🤖 Generated with Claude Code