-
-
Notifications
You must be signed in to change notification settings - Fork 863
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
[mob][Photos] CreationDate gets (randomly?) changed when downloading remote photo/video #4296
Comments
Can you confirm if the original file has exif date? |
The original file does have EXIF date. It was taken from a OnePlus 5T and has following EXIF (date) keys:
I also notice that some (quite a lot) of the files that were selected for download appear with the "not backed up" icon (striked cloud icon) in the "Pictures" folder (and those are the ones which appear in the "Today" section of the Pictures folder, eventhough most of them appear in the right date in the home timeline). Their unique album is "Pictures". As mentionned, I also find photos with EXIF dates in that section. The rest of the downloaded photos does not have the "not backed up" icon (striked cloud icon) in the "Pictures" folder and they appear in the right date in the pictures folder (and timeline). Their album is not "pictures" but the one(s) which were already set before downloading. There I find photos with and without EXIF dates. I will setup a test environment where I can mess a bit with the data to try to replicate, and will use the debug app to check if I can see something in the debug logs. |
@ua741 I was able to easily replicate the issue (multiple times) in a test environment and I am quite confident I understand what is happening. Let me first explain high level, then I'll show some logs.
ente/mobile/lib/utils/file_download_util.dart Line 186 in 7b002c8
Which is downloading/decrypting all assets localy, and evenutally inserting those files in the FilesDB (so far so good) : ente/mobile/lib/utils/file_download_util.dart Lines 219 to 227 in 7b002c8
This is simply done by collecting unique localIds in the FilesDB: ente/mobile/lib/db/files_db.dart Lines 959 to 972 in 7b002c8
This is starting by getting the list of all local assets using ente/mobile/lib/services/local_sync_service.dart Lines 292 to 300 in 7b002c8
ente/mobile/lib/services/local_sync_service.dart Lines 321 to 325 in 7b002c8
Logs Here is the important part of the logs, with timings, excluding unecessary parts: I have selected multiple files, and clicked on "download". File is downloaded/decrypted, and finally inserted in FilesDB (step 1) :
Then step 2 and 3 will be triggered and will compute the list of existing local file ids (which I display). This list does not contain the above local file id
It is then considered as a new file according to step 5 and it will get inserted (along with other "new" files, in a batch) in the FilesDB (with new generatedId, and almost no information, no hash as mentioned, etc). I am printing the query "values" :
As mentioned in step 9, the file gets flag (it has another generatedId 8274) :
Corrective actions will eventually occur but I would say it is already way after the issue I want to point. I am not sure why it does not show in the existing local file ids, it should already be in the table, even though it was only some ms before. My guess is that the download process is running concurrently to the sync process, and the insertion of the file in step 1 actually ended (or was commited) after computation of the list in step 3. The issue is that according to the DB it is not there, but looking at the assets, it is already there and it gets "flagged" as a new file. What I can tell is that I can replicate the issue every time I try to download lots of photos. I hope this helps. |
@ua741 Is Because I see the comment in here which is linked to the issue : ente/mobile/lib/utils/file_download_util.dart Lines 193 to 199 in b9d6864
And what I see, with extra log info, is that it gets stopped by one file, then directly started by another file (that finished its downloading) while the first has not yet finished its part that should not trigger a sync. Can this be linked? |
@simondubrulle Thank you taking time, and digging through this complex maze ;). From initial look at your comment, and from whatever I can recall, your analysis is correct.
Yes. We can may be put PS: In the future, we do plan to completely separate the local files & remote files. That would simplify many things, and help us avoid such bugs. |
Thank you for the feedback . I think it is a great suggestion, it should already reduce significantly the likelihood of such events while not introducing big changes 😊 |
Description
It is now the second time in only a few trials that this behaviour occurs.
Whenever I download remote files that are in my timeline (and not from a public shared album) but not yet on my device, the files get propely downloaded in the "Pictures" folder (assets are created) but some of the tiles will (likely) move to the top of the timeline in the "today" section. Looking at the photos info, the creation time is now today (at the time of the download). If I check the web app, it will also appear in the "today" section, like if it has been changed in the DB as well.
Steps to reproduce :
Expected behaviour :
Since Ente was already "aware" of the correct date, it should not change it when I download the photo locally.
Extra info :
I also noticed that in the "Pictures" album (which is not selected for backup), some of the downloaded photos will have the proper creation date assigned (in 2019, for example) but most of them will be in the "Today" section as well. At first I thought it was only pictures with no EXIF data but I can find some with Exif data as well. Actually, some photos from the same moment (few seconds apart) with both Exif data, same filename structure, do have both behaviour (one is in the "today" section, and the other one in the right day in 2019).
I was downloading +- 130 photos.
It also occured for videos.
I tried to have a look at the code, but apparently all it does is downloading the asset and update the file local_id with the one from the asset:
ente/mobile/lib/utils/file_download_util.dart
Lines 219 to 227 in 7b002c8
I am not sure of how the sync process is handling those events but it might be that some events are not processed properly.
Version
v0.9.65
What product are you using?
Ente Photos
What platform are you using?
Mobile - Android
The text was updated successfully, but these errors were encountered: