immich-app / immich

High performance self-hosted photo and video management solution.
https://immich.app
GNU Affero General Public License v3.0
34.45k stars 1.63k forks source link

[BUG] Files deleted outside the app result in broken image #2486

Open Sherlock1979 opened 1 year ago

Sherlock1979 commented 1 year ago

The bug

When I have a backed up asset on my mobile phone (cloud with check mark) and I delete it outside of Immich (e.g. with a file manager) then the Immich app shows a broken image.

Expected behaviour: image becomes "cloud only" and icon changes accordingly (cloud icon without check mark)

The OS that Immich Server is running on

Ubuntu 22.04

Version of Immich Server

1.56.0

Version of Immich Mobile App

1.55.0

Platform with the issue

Your docker-compose.yml content

Irrelevant

Your .env content

Irrelevant

Reproduction steps

1. Take a photo and create an Immich backup. Ensure you have a cloud with check mark icon.
2. Delete the photo on your phone using a file manager.
3. Refresh the timeline in Immich.

Additional information

No response

alextran1502 commented 1 year ago

Can you try update the app to the same version with the server to see if the issue persist? Also try pull to refresh the timeline as well

Sherlock1979 commented 1 year ago

Can you try update the app to the same version with the server to see if the issue persist? Also try pull to refresh the timeline as well

Checked with 1.56.1.

Same problem.

alextran1502 commented 1 year ago

How about logout and then login again?

Sherlock1979 commented 1 year ago

That's interesting. When I click 'Sign Out', the app (Android) does not sign me out but starts 'Building the timeline' which it does not finish even after several minutes, so I need to swipe out the app to get it closed. I think it is actually another bug. Do you want me to open another issue?

Once I signed out and swiped out the app, then I need to log in (so I guess it did sign me out anyways. And after logging back in, everything is fine. So there is no broken image and the small icon is a blank cloud (as it was supposed to be). So you were right, signing out and signing back in solves the problem. But I think it is still not the desired behaviour, right?

Sherlock1979 commented 1 year ago

1.57.1 same behaviour. Logging out and in fixes it but pull refresh does not.

fyfrey commented 1 year ago

I can not reproduce the error. What I did / how it turned out:

  1. Take a new picture.
  2. Background upload makes a backup
  3. Open Immich, see picture has cloud with checkmark
  4. Open native file app and delete that picture on device
  5. Open Immich: Initially, that picture had the cloud with checkmark. After 1-2 seconds, it changes to cloud (no checkmark)

I guess, we need some more details (and app logs) to figure out your issue.

Sherlock1979 commented 1 year ago

Thanks for looking into it .

In step 5, do you do anything when it changes to cloud? Like pull to refresh or force quit?

I tried to wait but nothing changed. Pull to refresh did not help either

Sherlock1979 commented 1 year ago

The key difference is background sync. I don't have that turned on.

Now I turned it on and the cloud icon changed just as you described.

But using only manual sync (without background sync and foreground sync), my steps can reproduce the bug.

fyfrey commented 1 year ago

I tried but again could not reproduce the issue (neither foreground nor background sync was enabled). Can you provide the logs (profile drawer, logs, share in the top right) of the app here after you encounter the issue?

Gorkycreator commented 10 months ago

I ran into a very similar issue, hope these steps to repeat provide useful info:

  1. On mobile (Android), copy one or more photos to a new album.
  2. Add this album as a backup album.
  3. Confirm Immich uploaded the photo(s).
  4. Outside Immich, delete all photos in the album that was just created.
  5. In my case, refreshing immich worked, but killing the app and reopening before the updates kick in created broken images (all black with a slashed image icon).

Enabling Prefer remote images (and refreshing) shows the image, but it was still registered as cloud and local. Logging out and back in again fixes the afflicted images.

server: 1.69.0 app: 1.68.0 build 91

d3vv3 commented 10 months ago

Enabling Prefer remote images (and refreshing) shows the image, but it was still registered as cloud and local. Logging out and back in again fixes the afflicted images.

This solved it for me, since they were showing on the web but not on the app. Thanks!

VenomousViper27 commented 8 months ago

I'm on iOS and just saw this issue as well. I do not have background or foreground sync turned on and after running a manual backup I deleted the images using the native photos app. When I returned to Immich this caused my photos and thumbnails to be broken until I logged out and back in to Immich. The couch and checkmark icon were on the broken images, so it appears Immich thinks these image are still on the device.

Does Immich check if local assets are still present when the app is launch or pull down refresh action is taken? I couldn't seem to get it to work until I logged out and back in (which caused my timeline to get re-built and causes quite a delay within the app as I have > 100K photos backed up on my server.

Running Immich app version 1.76.0 and server 1.76.1

alextran1502 commented 7 months ago

Hello is this issue still relevance? if not, can you help me close it?

Sherlock1979 commented 7 months ago

Hello is this issue still relevance? if not, can you help me close it?

Hi Alex, I changed the way I use Immich so I cannot test this scenario any more. I hope others have more valuable input to this. Otherwise, can be closed.

yodatak commented 7 months ago

I got the same issue how could I help?

fyfrey commented 7 months ago

@yodatak You could provide the app log exported as CSV directly after you encountered the issue and describe in a few steps what you did to trigger the issue. Please, also describe whether you use iOS or Android, how you selected your backup albums (e.g. only Recents, individual albums, excluded albums etc.). Thank you!

Sevyn13 commented 7 months ago

Hello is this issue still relevance? if not, can you help me close it?

Hi Alex, I changed the way I use Immich so I cannot test this scenario any more. I hope others have more valuable input to this. Otherwise, can be closed.

How do you use not now? I'm curious because I back up pics from phone to Immich then delete from phone. So I have this same problem with the way I use it. Dodntou find a better way?

Sherlock1979 commented 7 months ago

Hello is this issue still relevance? if not, can you help me close it?

Hi Alex, I changed the way I use Immich so I cannot test this scenario any more. I hope others have more valuable input to this. Otherwise, can be closed.

How do you use not now? I'm curious because I back up pics from phone to Immich then delete from phone. So I have this same problem with the way I use it. Dodntou find a better way?

I upload the photos to the server with a different tool and then use the CLI to add the photos to Immich. This was I can freely delete photos on my phone as I wish without interfering with my Immich library.

Sevyn13 commented 7 months ago

What tool do you use to go from phone to server?

Sherlock1979 commented 7 months ago

What tool do you use to go from phone to server?

Foldersync

Other considerations can be Syncthing, Resilio Sync, RoundSync. Each has its own pros and cons...

A1bi commented 6 months ago

I'm experiencing the same issue. Deleting a file from device but keeping it in the remote backup results in a broken image icon in the Immich app. Logging out and in again resolves the issue until another file is deleted.

I've noticed a small spinner next to the photos icon in the bottom bar. I don't know what activity it is supposed to indicate, but it's constantly spinning at all times and therefore maybe related to this issue?

I'm also seeing a lot of the following log entries:

Catch all error: PathNotFoundException: Cannot retrieve length of file, path = '/private/var/mobile/Containers/Data/Application/37E8F17F-786C-461B-9FE0-3285AC35EF63/tmp/.image/D6574BD9-5305-435F-9F46-1737AF95B415_L0_001_0.000000_o_IMG_2526.HEIC' (OS Error: No such file or directory, errno = 2) - PathNotFoundException: Cannot retrieve length of file, path = '/private/var/mobile/Containers/Data/Application/37E8F17F-786C-461B-9FE0-3285AC35EF63/tmp/.image/D6574BD9-5305-435F-9F46-1737AF95B415_L0_001_0.000000_o_IMG_2526.HEIC' (OS Error: No such file or directory, errno = 2)

and

Catch all error:  - PlatformException(asset is not found, null, null, null) - image resource service - resolving an image codec - #0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:652)
#1      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:310)
<asynchronous suspension>
#2      AssetEntityImageProvider._loadAsync.<anonymous closure> (package:photo_manager/src/internal/image_provider.dart:132)
<asynchronous suspension>

I'm using Immich server 1.88.2 and Immich iOS 1.88.0 build.128.

arnelap commented 3 months ago

Same issue om Android.

File deleted from device still showing as broken image in immich app.

Logout and then login again starts rebuilding timeline and fixed the issue. Another way to rebuild the timeline may be sufficient (eg as option I'm settings)

Note that the deleted images where in a folder that I used to set as a backup folder and then removed, bit the images stayed in the library. As there is no good way to select a lot of images at once I removed them from device...

Version 1.97 build 125

mdafer commented 2 weeks ago

+1 and the problem is actually worse... Opening a removed file in the Android app deletes it from the cloud.

Details:

1- My phone and cloud were in sync. 2- I deleted the images folder from the phone (using File Explorer on Android) 3- I opened the Immich app 4- It was still showing the tick inside the cloud but no thumbnail 5- I clicked on a couple videos (with no thumbnail) 6- the videos I clicked on got deleted from the cloud 7- Restored the deleted folder from the trash 8- Logged out and back in to Immich Android app 9- Immich did not detect what was already synced and what was not, it reported that the whole folder needs to be uploaded 10- Background sync uploaded the whole folder (that was previously deleted and then restored) again

alextran1502 commented 2 weeks ago

@mdafer Which phone model are you using? Do you mind recording a screen capture and sharing it here so I can try to reproduce what you are seeing?

mdafer commented 2 weeks ago

@alextran1502 I will post a video (gif) shortly, but here's some more details:

I will post a video of what I did, but the results may not be the same as the changes seem to be permanent for now...

alextran1502 commented 2 weeks ago

@mdafer can you create a test account on your instance and create a sample local maybe around 10 test asset to perform the reproduction of the error? That would be easier to follow and manage

mdafer commented 2 weeks ago

Ah sure, I forgot that deduplication doesn't work across accounts... I'm on it

mdafer commented 2 weeks ago

@alextran1502 I'm unable to reproduce the issue unfortunately. One thing I noticed though is that the issue happened on server version 1.105.0, while now I'm using 1.105.1. If this is a known issue of the previous version then I'm very sorry for wasting your time... Otherwise, the issue remains a mystery. And, on that account, I'm still unable to retrieve/upload the lost files, they are being considered as duplicates (I've already checked the trash and they're not there).

alextran1502 commented 2 weeks ago

@mdafer try to go into App Setting > Advanced > remote duplicate database and try again

mdafer commented 2 weeks ago

@alextran1502

mdafer commented 2 weeks ago

Update, I found the 3 files in the archive, somehow they got archived, not deleted.