-
-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Catch and log error thrown while parsing dates from metadata #2186
Conversation
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
a6f16e7
to
5c9bb54
Compare
@MichaIng Could you test this fix? |
/backport to stable28 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works. I get now the expected warnings and see the affected files, indeed all from the same camera. Here one example:
{
"reqId": "IyHWBbnfR5zAjQH8yezr",
"level": 2,
"time": "2023-12-11T13:45:20+01:00",
"remoteAddr": "",
"user": "--",
"app": "photos",
"method": "",
"url": "--",
"message": "Failed to parse date 0000:00:00 00:00:00 for file /user/files/path/to/image.jpg",
"userAgent": "--",
"version": "28.0.0.10",
"exception": {
"Exception": "ValueError",
"Message": "Epoch doesn't fit in a PHP integer",
"Code": 0,
"Trace": [
{
"file": "/var/www/nextcloud/apps/photos/lib/Listener/OriginalDateTimeMetadataProvider.php",
"line": 53,
"function": "getTimestamp",
"class": "DateTime",
"type": "->"
},
{
"file": "/var/www/nextcloud/apps/photos/lib/Listener/OriginalDateTimeMetadataProvider.php",
"line": 90,
"function": "dateToTimestamp",
"class": "OCA\\Photos\\Listener\\OriginalDateTimeMetadataProvider",
"type": "->"
},
{
"file": "/var/www/nextcloud/lib/private/EventDispatcher/ServiceEventListener.php",
"line": 86,
"function": "handle",
"class": "OCA\\Photos\\Listener\\OriginalDateTimeMetadataProvider",
"type": "->"
},
{
"file": "/var/www/nextcloud/3rdparty/symfony/event-dispatcher/EventDispatcher.php",
"line": 230,
"function": "__invoke",
"class": "OC\\EventDispatcher\\ServiceEventListener",
"type": "->"
},
{
"file": "/var/www/nextcloud/3rdparty/symfony/event-dispatcher/EventDispatcher.php",
"line": 59,
"function": "callListeners",
"class": "Symfony\\Component\\EventDispatcher\\EventDispatcher",
"type": "->"
},
{
"file": "/var/www/nextcloud/lib/private/EventDispatcher/EventDispatcher.php",
"line": 94,
"function": "dispatch",
"class": "Symfony\\Component\\EventDispatcher\\EventDispatcher",
"type": "->"
},
{
"file": "/var/www/nextcloud/lib/private/EventDispatcher/EventDispatcher.php",
"line": 106,
"function": "dispatch",
"class": "OC\\EventDispatcher\\EventDispatcher",
"type": "->"
},
{
"file": "/var/www/nextcloud/lib/private/FilesMetadata/FilesMetadataManager.php",
"line": 115,
"function": "dispatchTyped",
"class": "OC\\EventDispatcher\\EventDispatcher",
"type": "->"
},
{
"file": "/var/www/nextcloud/core/BackgroundJobs/GenerateMetadataJob.php",
"line": 105,
"function": "refreshMetadata",
"class": "OC\\FilesMetadata\\FilesMetadataManager",
"type": "->"
},
{
"file": "/var/www/nextcloud/core/BackgroundJobs/GenerateMetadataJob.php",
"line": 101,
"function": "scanFolder",
"class": "OC\\Core\\BackgroundJobs\\GenerateMetadataJob",
"type": "->"
},
{
"file": "/var/www/nextcloud/core/BackgroundJobs/GenerateMetadataJob.php",
"line": 101,
"function": "scanFolder",
"class": "OC\\Core\\BackgroundJobs\\GenerateMetadataJob",
"type": "->"
},
{
"file": "/var/www/nextcloud/core/BackgroundJobs/GenerateMetadataJob.php",
"line": 90,
"function": "scanFolder",
"class": "OC\\Core\\BackgroundJobs\\GenerateMetadataJob",
"type": "->"
},
{
"file": "/var/www/nextcloud/core/BackgroundJobs/GenerateMetadataJob.php",
"line": 81,
"function": "scanFilesForUser",
"class": "OC\\Core\\BackgroundJobs\\GenerateMetadataJob",
"type": "->"
},
{
"file": "/var/www/nextcloud/lib/public/BackgroundJob/Job.php",
"line": 81,
"function": "run",
"class": "OC\\Core\\BackgroundJobs\\GenerateMetadataJob",
"type": "->"
},
{
"file": "/var/www/nextcloud/lib/public/BackgroundJob/TimedJob.php",
"line": 102,
"function": "start",
"class": "OCP\\BackgroundJob\\Job",
"type": "->"
},
{
"file": "/var/www/nextcloud/lib/public/BackgroundJob/TimedJob.php",
"line": 92,
"function": "start",
"class": "OCP\\BackgroundJob\\TimedJob",
"type": "->"
},
{
"file": "/var/www/nextcloud/core/Command/Background/Job.php",
"line": 89,
"function": "execute",
"class": "OCP\\BackgroundJob\\TimedJob",
"type": "->"
},
{
"file": "/var/www/nextcloud/3rdparty/symfony/console/Command/Command.php",
"line": 298,
"function": "execute",
"class": "OC\\Core\\Command\\Background\\Job",
"type": "->"
},
{
"file": "/var/www/nextcloud/3rdparty/symfony/console/Application.php",
"line": 1040,
"function": "run",
"class": "Symfony\\Component\\Console\\Command\\Command",
"type": "->"
},
{
"file": "/var/www/nextcloud/3rdparty/symfony/console/Application.php",
"line": 301,
"function": "doRunCommand",
"class": "Symfony\\Component\\Console\\Application",
"type": "->"
},
{
"file": "/var/www/nextcloud/3rdparty/symfony/console/Application.php",
"line": 171,
"function": "doRun",
"class": "Symfony\\Component\\Console\\Application",
"type": "->"
},
{
"file": "/var/www/nextcloud/lib/private/Console/Application.php",
"line": 206,
"function": "run",
"class": "Symfony\\Component\\Console\\Application",
"type": "->"
},
{
"file": "/var/www/nextcloud/console.php",
"line": 100,
"function": "run",
"class": "OC\\Console\\Application",
"type": "->"
},
{
"file": "/var/www/nextcloud/occ",
"line": 11,
"args": [
"/var/www/nextcloud/console.php"
],
"function": "require_once"
}
],
"File": "/var/www/nextcloud/apps/photos/lib/Listener/OriginalDateTimeMetadataProvider.php",
"Line": 53,
"message": "Failed to parse date {date} for file {path}",
"exception": {},
"CustomMessage": "Failed to parse date 0000:00:00 00:00:00 for file /user/files/path/to/image.jpg"
}
}
I guess the date 0000:00:00 00:00:00
is expected in case it failed completely. Although, exiftool
also shows this. Is it probably an issue, because the year 0 is too far before 1970?
Modify Date : 0000:00:00 00:00:00
Y Cb Cr Positioning : Co-sited
Exposure Time : 1/250
F Number : 2.7
Exposure Program : Program AE
ISO : 200
Sensitivity Type : Standard Output Sensitivity
Exif Version : 0230
Date/Time Original : 0000:00:00 00:00:00
Create Date : 0000:00:00 00:00:00
Should be fine to see this warning once for every affected file. I guess that I saw this eery day was just because the background job crashed at the same point every time?
@MichaIng Thank you for testing! On 64bits for this all 0 dates I get a timestamp of @artonge Should we add a special case for this date value? Even on 64bits it won’t help people to have all their pictures dated back to year 0. But it’s hard to know if this issue is very specific to this camera or if it’s common to have this value. |
I think we can just ignore the 0 value, as t does not make sense. I think it's better to have nothing than a wrong value and we'll default to the mtime anyway. |
Ok to merge @come-nc? |
We should still add something to ignore all-zero timestamps, but in the mean time we should merge this yeah. |
Fix #2185