-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Checksum collision with completely different photos #10546
Comments
@fyfrey I'm having a look at the app's hashing code and there's a fair bit of array index juggling. Nothing stands out to me immediately, but how likely do you think it is that there's some edge case where indexes get misaligned or such? @miahi can you pull the complete logs from the app? I'm particularly interested to see what got logged at the time it calculated all the hashes. |
The logs might be a bit "dirty" as I was trying a lot of things today as I was trying to understand what is happening with #6196 (two of the photos missing there are found as duplicates in the logs). I tried uploading the two files on a different account directly to the web app and both were accepted. I can do other tests if needed. |
I'll need to check. An edge case bug is certainly possible. We can also just check if these files happen to produce a hash collision for sha1 (unlikely, but we should rule this out first) |
@bo0tzz I checked the code as I thought maybe it's a custom hash implementation but it's just SHA1, fat chance of random collisions there. The SHA1 hash of the old file is correct (GNrECa7lbm6smQHTdW5Rbf99NNU= in base64), but then the second one should be JpWUN7FvqDoak41elMrIc7wsH64= but it's somehow mixed with the first one in the app. What I also did today (a lot) was to remove and re-add libraries into the app to try to find a pattern for #6196 - that might also be related somehow to indexing, as it seems that the app is not showing photos from one library when it is showing photos from another. I have 3 libraries on the phone with > 6000 photos each. Sometimes I added multiple libraries at the same time. But #6196 seems to be deterministic, the same photos were missing from the app every time I added the libraries. So it might be that the same bug that assigns the wrong hash to some of the photos is causing the missing photos too (maybe overwriting other data?). |
I checked as well, it's definitely not a hash collision. |
I can think of one scenario causing issues: |
You are right. I changed my phone a while back and used a migration app to move the data (via cable connection). It moved the photos and I think also the immich local storage. That was around 1st of March 2024. I remember that I had to do a login and resync at that point, but I don't think the local DB was cleaned. I cleared the app data and I'm doing a new sync now. There were ~500 images in that Camera album that were not synced before and they were synced after the cleanup. Not all of them were reported as duplicates, but all of them were shot on the new phone. |
Copying over immich data was the issue: we need to keep a mapping between asset ID and its file hash (otherwise we'd need to calculate all hashes on app start again and again). This mapping is wrong when moving the data to a new phone or when restoring a backup. We have this as an open issue somewhere.... To detect this case and ask the user to delete app data. |
I think this is one of them #4939 |
The bug
I have an issue with missing photos whilst showing/syncing photos with the Android app, and looking through the logs I found this (amongst other 200+ duplicate warnings). Full log entry is below in the 'Relevant log output'.
I checked the photos, both of them are in the same directory on the phone but they are completely different, taken at different times, different file size, different phones (extracted from the phone and attached in zip to make sure they are not changed in any way - not sure how the checksum is calculated)
immich_collision.zip
The newer photo (20240622_075114.jpg) does not show in the immich app and is not synced to server. The older one (20230919_211125.jpg) is backed up to the server, and shows in the app.
The OS that Immich Server is running on
Debian
Version of Immich Server
v1.106.4
Version of Immich Mobile App
v1.106.3 build.143
Platform with the issue
Your docker-compose.yml content
Your .env content
Reproduction steps
Relevant log output
Additional information
No response
The text was updated successfully, but these errors were encountered: