immich
immich copied to clipboard
Metadata extraction jobs need better error handling
Both the image exif and video metadata jobs need better error handling. Currently, both are wrapped in one big try/catch that just gives up on any errors. Meanwhile, any bad data that doesn't cause an immediate exception isn't validated well and causes an error on database insert:
ERROR [MetadataExtractionProcessor] Error extracting EXIF QueryFailedError: invalid input syntax for type timestamp with time zone: "0NaN-NaN-NaNTNaN:NaN:NaN.NaN+NaN:NaN"
QueryFailedError: invalid input syntax for type timestamp with time zone: "0NaN-NaN-NaNTNaN:NaN:NaN.NaN+NaN:NaN"
at PostgresQueryRunner.query (/usr/src/app/node_modules/typeorm/driver/postgres/PostgresQueryRunner.js:211:19)
(...)
Another problem is that these jobs are responsible for saving the original filename as passed in the asset upload call. If these jobs fail, that filename is lost.
This needs some refactoring so that
- Better data validation is performed.
- A best-effort attempt is made to still save whatever data can be saved to the database when an error occurs.
- All errors are clearly logged with relevant (asset) IDs and, where applicable, actionable error messages.
I don't think #2230 addressed 1 nor 2 points.
Should be resolved by #2908.