Repository navigation
Do not silently discard errors raised while finishing a ZIM - #354
Merged
Merged
Conversation
Creator.finish() caught and dropped every RuntimeError raised by libzim's finishZimCreation(), including genuine finalization failures, so a scraper could exit successfully (code 0) with no final ZIM file and no error logged. Track whether finish() already ran instead, so a second call stays a no-op but a real error on the first call now propagates.
benoit74
force-pushed
the
fix-silent-finish-error
branch
from
October 16, 2026 11:56
a3e8c7f to
e7d9b60
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #354 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 42 42
Lines 2728 2729 +1
Branches 405 406 +1
=========================================
+ Hits 2728 2729 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Summary
Creator.finish()wrapped the call into libzim'sfinishZimCreation()with a blanketexcept RuntimeError: pass. That was originally meant to make a redundant/double call tofinish()a no-op (seetest_double_finish), but it also silently discards a genuine finalization failure: the scraper then exits successfully (code 0) with no final.zimfile and no error logged anywhere.This is the root cause of openzim/warc2zim#462: warc2zim logs "Detect dangling redirects" / "Detect loops and/or blind chains of redirects" / "Index titles" (all from libzim's
finishZimCreation()), then an error occurs somewhere later in that same native finalization sequence, gets turned into a PythonRuntimeError, and is swallowed here.Converter.run()then returns normally,warc2zimexits 0, and the half-written.zim.tmpis removed by libzim's own cleanup with no further log line.Changes
finish()already ran via a_finish_calledflag instead of blindly catchingRuntimeError. A second call is still a no-op (preserving the original intent), but a real error on the first call now propagates instead of being discarded.test_finish_error_propagatescovering this.