Fix crashes in thumbnails generation #342
Merged
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.
While generating thumbnails for a big old photos library (~12k photos), encountered two distinct crashes in the thumbnail processor:
And also:
Ran the thumbnail_processor a few times until I was left with 2 problematic images that generated those errors.
Each time a rescan of the images happened, another 2 tasks for those images were duplicated, I also had to manually run the thumbnail_processor, it seems to not restart like the object and face detection.
After seeing the 2 images files, it seems they are corrupted from a recovery attempt I've made some years ago (lost some data).
After searching for a solution and contemplating how to fix this, found this thread: python-pillow/Pillow#3185
This flag will let Pillow read files even if they're corrupted/truncated (no EOI marker 0xffd9), so photonix can continue processing gracefully.
One can argue that maybe it's best to catch those exceptions and make:
But different formats can have different exceptions for those corrupted images, so requires more testing and fiddling before implementing something like this.