immich-app / immich

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

[BUG] iOS app upload repeat error #4339

Open presario222 opened 9 months ago

presario222 commented 9 months ago

The bug

ios app upload frequently had error "PathNotFoundException" with "can not open file" or "can not delete file".

I have setup a shared album on iphone but the immich uploading album is "Recents", the default one in iphone. and I open the icloud function "optimize iphone storage" to save some space.

1af2db0533a6a755e437c7e9f921e96

The OS that Immich Server is running on

Unraid

Version of Immich Server

v1.81

Version of Immich Mobile App

latest

Platform with the issue

Your docker-compose.yml content

version: "3.8"

services:
  immich-server:
    container_name: immich_server
    image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
    command: [ "start.sh", "immich" ]
    volumes:
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
      - /mnt/user/media/pictures:/mnt/user/media/pictures
    env_file:
      - .env
    depends_on:
      - redis
      - database
      - typesense
    restart: always

  immich-microservices:
    container_name: immich_microservices
    image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
    # extends:
    #   file: hwaccel.yml
    #   service: hwaccel
    command: [ "start.sh", "microservices" ]
    volumes:
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
      - /mnt/user/media/pictures:/mnt/user/media/pictures
    env_file:
      - .env
    depends_on:
      - redis
      - database
      - typesense
    restart: always

  immich-machine-learning:
    container_name: immich_machine_learning
    image: ghcr.io/immich-app/immich-machine-learning:${IMMICH_VERSION:-release}
    volumes:
      - model-cache:/cache
    env_file:
      - .env
    restart: always

  immich-web:
    container_name: immich_web
    image: ghcr.io/immich-app/immich-web:${IMMICH_VERSION:-release}
    env_file:
      - .env
    restart: always

  typesense:
    container_name: immich_typesense
    image: typesense/typesense:0.24.1@sha256:9bcff2b829f12074426ca044b56160ca9d777a0c488303469143dd9f8259d4dd
    environment:
      - TYPESENSE_API_KEY=${TYPESENSE_API_KEY}
      - TYPESENSE_DATA_DIR=/data
      # remove this to get debug messages
      - GLOG_minloglevel=1
    volumes:
      - tsdata:/data
    restart: always

  redis:
    container_name: immich_redis
    image: redis:6.2-alpine@sha256:70a7a5b641117670beae0d80658430853896b5ef269ccf00d1827427e3263fa3
    restart: always

  database:
    container_name: immich_postgres
    image: postgres:14-alpine@sha256:28407a9961e76f2d285dc6991e8e48893503cc3836a4755bbc2d40bcc272a441
    env_file:
      - .env
    environment:
      POSTGRES_PASSWORD: ${DB_PASSWORD}
      POSTGRES_USER: ${DB_USERNAME}
      POSTGRES_DB: ${DB_DATABASE_NAME}
    volumes:
      - pgdata:/var/lib/postgresql/data
    restart: always

  immich-proxy:
    container_name: immich_proxy
    image: ghcr.io/immich-app/immich-proxy:${IMMICH_VERSION:-release}
    environment:
      # Make sure these values get passed through from the env file
      - IMMICH_SERVER_URL
      - IMMICH_WEB_URL
    ports:
      - 2283:8080
    depends_on:
      - immich-server
      - immich-web
    restart: always

volumes:
  pgdata:
  model-cache:
  tsdata:

Your .env content

# You can find documentation for all the supported env variables at https://immich.app/docs/install/environment-variables

# The location where your uploaded files are stored
UPLOAD_LOCATION=/mnt/user/media/photos

# The Immich version to use. You can pin this to a specific version like "v1.71.0"
IMMICH_VERSION=release

# Connection secrets for postgres and typesense. You should change these to random passwords
TYPESENSE_API_KEY=eiwokdnsjgfds1234jgf
DB_PASSWORD=postgres

# The values below this line do not need to be changed
###################################################################################
DB_HOSTNAME=immich_postgres
DB_USERNAME=postgres
DB_DATABASE_NAME=immich

REDIS_HOSTNAME=immich_redis

Reproduction steps

1.setup the immich server follow the guide.
2.download the iphone app and start to upload
3.the app's log will show error information
...

Additional information

No response

vongoethe commented 9 months ago

I have the same issue

jetblack-nz commented 8 months ago

Same issue here on version 1.85. I'm backing up a large iOS library (with iCloud enabled).

When the error appears the backup from the immich app stops, and I have to cancel and start backup again. There are no errors on the server side.

This also prevent the background backup to work consistently.

alextran1502 commented 8 months ago

@jetblack-nz Can you elaborate on what error are you seeing, are you accessing over DNS or local IP?

jetblack-nz commented 8 months ago

Hi @alextran1502 thanks for answering and for the great app!

The error on my iOS app matches the screenshot of the OP. The app log shows "PathNotFoundException" with "can not open file" or "can not delete file". See below.

The issue happens every few minutes. I don't have shared albums yet, it's a fresh server install with the first backup churning through 55k photos which mostly are on iCloud.

I'm happy to provide more info or help with testing... I self-host quite a few apps and can set up a new VM or LXC in minutes.

Catch all error: PathNotFoundException: Cannot delete file, path = '/private/var/mobile/Containers/Data/Application/09EC83EA-ECCD-412E-8D5C-3DB0F23D9831/tmp/.image/D44C463E-91C0-4187-ABC5-62A1BDE57A62_L0_001_1574712794.916106_o_FullSizeRender.jpg' (OS Error: No such file or directory, errno = 2) - PathNotFoundException: Cannot delete file, path = '/private/var/mobile/Containers/Data/Application/09EC83EA-ECCD-412E-8D5C-3DB0F23D9831/tmp/.image/D44C463E-91C0-4187-ABC5-62A1BDE57A62_L0_001_1574712794.916106_o_FullSizeRender.jpg' (OS Error: No such file or directory, errno = 2)

Uberpainer commented 8 months ago

I have the same issue on ser version 1.86 and iOS app version 1.86 in iOS 17. Did try reinstall the application and restart the containers without any luck. I have to kill the stalled backup in the application and then start it over to backup any other pictures taken after error.

`2023-11-15 19:42:54.073644,LogLevel.SEVERE,"ImmichErrorLogger","Catch all error: PathNotFoundException: Cannot open file, path = '/private/var/mobile/Containers/Data/Application/9B57F0FA-BD38-456D-8F9A-D0C410694481/tmp/.image/9D2DC033-393C-4A4D-8C14-BD0E6F3A9C09_L0_001_0.000000_o_IMG_2494.JPG' (OS Error: No such file or directory, errno = 2) - PathNotFoundException: Cannot open file, path = '/private/var/mobile/Containers/Data/Application/9B57F0FA-BD38-456D-8F9A-D0C410694481/tmp/.image/9D2DC033-393C-4A4D-8C14-BD0E6F3A9C09_L0_001_0.000000_o_IMG_2494.JPG' (OS Error: No such file or directory, errno = 2)","#0 _checkForErrorResponse (dart:io/common.dart:55)

1 _File.open. (dart:io/file_impl.dart:381)

#2 _FileStream._start.onOpenFile (dart:io/file_impl.dart:153) " 2023-11-15 19:42:52.592458,LogLevel.SEVERE,"ImmichErrorLogger","Catch all error: PathNotFoundException: Cannot open file, path = '/private/var/mobile/Containers/Data/Application/9B57F0FA-BD38-456D-8F9A-D0C410694481/tmp/.image/9D2DC033-393C-4A4D-8C14-BD0E6F3A9C09_L0_001_0.000000_o_IMG_2494.JPG' (OS Error: No such file or directory, errno = 2) - PathNotFoundException: Cannot open file, path = '/private/var/mobile/Containers/Data/Application/9B57F0FA-BD38-456D-8F9A-D0C410694481/tmp/.image/9D2DC033-393C-4A4D-8C14-BD0E6F3A9C09_L0_001_0.000000_o_IMG_2494.JPG' (OS Error: No such file or directory, errno = 2)","#0 _checkForErrorResponse (dart:io/common.dart:55) #1 _File.open. (dart:io/file_impl.dart:381) #2 _FileStream._start.onOpenFile (dart:io/file_impl.dart:153) "`
alextran1502 commented 8 months ago

@Uberpainer Are you using iCloud with Optimized Storage options enabled?

Uberpainer commented 8 months ago

@alextran1502 No on both mine and her iPhone are Optimized Storage options not enabled. It's set to keep originals.

alextran1502 commented 8 months ago

@Uberpainer just to confirm that iCloud is used, correct?

Uberpainer commented 8 months ago

@alextran1502 Yes, thats is correct. Issue only appear on my wifes iPhone and not mine. If you need me to test anything please say, I'm here to help as much as possible eventhough my lack of programming skills ;)

vitobotta commented 7 months ago

Same problem here, just checked the logs on iPhone after noticing that it's getting stuck often. Any workarounds for now? (I have iCloud enabled BTW). Thanks

alextran1502 commented 7 months ago

@vitobotta are you on 1.90? There is a toggle to ignore iCloud photos and videos. Let me know if it works

Uberpainer commented 7 months ago

After updated version i iOS app to version 1.90 and running server version 1.90.2 then does errors still occour. And thats even after I have set Immich app on my wife phone to ignore iCloud Photos. Immich_log_2023-12-09T204935.138182.csv Immich_log_2023-12-10T151028.850868.csv

vitobotta commented 7 months ago

@vitobotta are you on 1.90? There is a toggle to ignore iCloud photos and videos. Let me know if it works

Hi Alex, yep latest versions both server and mobile app. I tried ignoring iCloud photos but the upload just stopped working altogether. Then I reinstalled the app and left it turned on to try again with it enabled and now it's been uploading happily for a while so I will wait for now to see if it finishes. It has done 5k out of 50k photos and videos and it's not getting stuck so far, so seems to be going better now :)

talan-z commented 7 months ago

Hi all, I have the same issue. Latest version and only uploading "recent pictures" folder and have icloud turned off.. Reinstall of the app did not help

mtehonica commented 7 months ago

Having the same problem on a fresh install of Immich 1.91.3, doing an initial backup of 7k photos. iCloud enabled, Optimized Storage enabled.

Catch all error: PathNotFoundException: Cannot delete file, path = '/private/var/mobile/Containers/Data/Application/59CAE3CB-1B56-47B5-A5F5-D10E5D2CC60F/tmp/.image/05EAEBBA-0D9E-40A4-8CA7-F0A88EB029CC_L0_001_1700290858.416805_o_IMG_4075.PNG' (OS Error: No such file or directory, errno = 2) - PathNotFoundException: Cannot delete file, path = '/private/var/mobile/Containers/Data/Application/59CAE3CB-1B56-47B5-A5F5-D10E5D2CC60F/tmp/.image/05EAEBBA-0D9E-40A4-8CA7-F0A88EB029CC_L0_001_1700290858.416805_o_IMG_4075.PNG' (OS Error: No such file or directory, errno = 2)

`

0 _File.throwIfError (dart:io/file_impl.dart:675)

1 _File._deleteSync (dart:io/file_impl.dart:329)

2 FileSystemEntity.deleteSync (dart:io/file_system_entity.dart:424)

3 BackupService.backupAsset (package:immich_mobile/modules/backup/services/backup.service.dart:398)

#4 BackupNotifier.startBackupProcess (package:immich_mobile/modules/backup/providers/backup.provider.dart:461) `
alextran1502 commented 7 months ago

Having the same problem on a fresh install of Immich 1.91.3, doing an initial backup of 7k photos. iCloud enabled, Optimized Storage enabled.

Catch all error: PathNotFoundException: Cannot delete file, path = '/private/var/mobile/Containers/Data/Application/59CAE3CB-1B56-47B5-A5F5-D10E5D2CC60F/tmp/.image/05EAEBBA-0D9E-40A4-8CA7-F0A88EB029CC_L0_001_1700290858.416805_o_IMG_4075.PNG' (OS Error: No such file or directory, errno = 2) - PathNotFoundException: Cannot delete file, path = '/private/var/mobile/Containers/Data/Application/59CAE3CB-1B56-47B5-A5F5-D10E5D2CC60F/tmp/.image/05EAEBBA-0D9E-40A4-8CA7-F0A88EB029CC_L0_001_1700290858.416805_o_IMG_4075.PNG' (OS Error: No such file or directory, errno = 2)

#0 _File.throwIfError (dart:io/file_impl.dart:675) #1 _File._deleteSync (dart:io/file_impl.dart:329) #2 FileSystemEntity.deleteSync (dart:io/file_system_entity.dart:424) #3 BackupService.backupAsset (package:immich_mobile/modules/backup/services/backup.service.dart:398) <asynchronous suspension> #4 BackupNotifier.startBackupProcess (package:immich_mobile/modules/backup/providers/backup.provider.dart:461) <asynchronous suspension>

@mtehonica Fixed in #5827

mtehonica commented 7 months ago

Having the same problem on a fresh install of Immich 1.91.3, doing an initial backup of 7k photos. iCloud enabled, Optimized Storage enabled. Catch all error: PathNotFoundException: Cannot delete file, path = '/private/var/mobile/Containers/Data/Application/59CAE3CB-1B56-47B5-A5F5-D10E5D2CC60F/tmp/.image/05EAEBBA-0D9E-40A4-8CA7-F0A88EB029CC_L0_001_1700290858.416805_o_IMG_4075.PNG' (OS Error: No such file or directory, errno = 2) - PathNotFoundException: Cannot delete file, path = '/private/var/mobile/Containers/Data/Application/59CAE3CB-1B56-47B5-A5F5-D10E5D2CC60F/tmp/.image/05EAEBBA-0D9E-40A4-8CA7-F0A88EB029CC_L0_001_1700290858.416805_o_IMG_4075.PNG' (OS Error: No such file or directory, errno = 2) #0 _File.throwIfError (dart:io/file_impl.dart:675) #1 _File._deleteSync (dart:io/file_impl.dart:329) #2 FileSystemEntity.deleteSync (dart:io/file_system_entity.dart:424) #3 BackupService.backupAsset (package:immich_mobile/modules/backup/services/backup.service.dart:398) <asynchronous suspension> #4 BackupNotifier.startBackupProcess (package:immich_mobile/modules/backup/providers/backup.provider.dart:461) <asynchronous suspension>

@mtehonica Fixed in #5827

5827 doesn't seem to have resolved this. Still seeing this on 1.91.4.

Catch all error: PathNotFoundException: Cannot delete file, path = '/private/var/mobile/Containers/Data/Application/59CAE3CB-1B56-47B5-A5F5-D10E5D2CC60F/tmp/.image/2EDFA739-B179-43F8-B1A8-12BD4817560C_L0_001_1700290858.381235_o_FullSizeRender.jpg' (OS Error: No such file or directory, errno = 2) - PathNotFoundException: Cannot delete file, path = '/private/var/mobile/Containers/Data/Application/59CAE3CB-1B56-47B5-A5F5-D10E5D2CC60F/tmp/.image/2EDFA739-B179-43F8-B1A8-12BD4817560C_L0_001_1700290858.381235_o_FullSizeRender.jpg' (OS Error: No such file or directory, errno = 2)

0 _File.throwIfError (dart:io/file_impl.dart:675)

1 _File._deleteSync (dart:io/file_impl.dart:329)

2 FileSystemEntity.deleteSync (dart:io/file_system_entity.dart:424)

3 BackupService.backupAsset (package:immich_mobile/modules/backup/services/backup.service.dart:398

4 BackupNotifier.startBackupProcess (package:immich_mobile/modules/backup/providers/backup.provider.dart:461)

alextran1502 commented 7 months ago

@mtehonica is your mobile app on 1.91.4?

Uberpainer commented 7 months ago

@alextran1502 , I have updated my wife mobile app to version 1.91.4 and run server version 1.91.4. But are still seeing issue with sync failing and stops. Keeps spinning in the "cloud icon" in the app, at give this error in the log:

created_at,level,context,message,stacktrace 2023-12-20 16:11:04.954693,LogLevel.SEVERE,"ImmichErrorLogger","Catch all error: PathNotFoundException: Cannot open file, path = '/private/var/mobile/Containers/Data/Application/F7F2D158-7CDB-4F64-BAC1-6A05F6B9A9C1/tmp/.image/4D5C31AA-EC3A-4626-A76A-A71D2C81F823_L0_001_1702855632.121231_o_IMG_2051.HEIC' (OS Error: No such file or directory, errno = 2) - PathNotFoundException: Cannot open file, path = '/private/var/mobile/Containers/Data/Application/F7F2D158-7CDB-4F64-BAC1-6A05F6B9A9C1/tmp/.image/4D5C31AA-EC3A-4626-A76A-A71D2C81F823_L0_001_1702855632.121231_o_IMG_2051.HEIC' (OS Error: No such file or directory, errno = 2)","#0 _checkForErrorResponse (dart:io/common.dart:55)

1 _File.open. (dart:io/file_impl.dart:381)

#2 _FileStream._start.onOpenFile (dart:io/file_impl.dart:153) " 2023-12-20 16:11:04.954463,LogLevel.INFO,"AssetNotifier","Load partner assets: 5069ms","" 2023-12-20 16:11:03.344731,LogLevel.INFO,"AssetNotifier","Load assets: 3445ms","" 2023-12-20 16:11:03.344658,LogLevel.SEVERE,"ImmichErrorLogger","Catch all error: PathNotFoundException: Cannot open file, path = '/private/var/mobile/Containers/Data/Application/F7F2D158-7CDB-4F64-BAC1-6A05F6B9A9C1/tmp/.image/4D5C31AA-EC3A-4626-A76A-A71D2C81F823_L0_001_1702855632.121231_o_IMG_2051.HEIC' (OS Error: No such file or directory, errno = 2) - PathNotFoundException: Cannot open file, path = '/private/var/mobile/Containers/Data/Application/F7F2D158-7CDB-4F64-BAC1-6A05F6B9A9C1/tmp/.image/4D5C31AA-EC3A-4626-A76A-A71D2C81F823_L0_001_1702855632.121231_o_IMG_2051.HEIC' (OS Error: No such file or directory, errno = 2)","#0 _checkForErrorResponse (dart:io/common.dart:55) #1 _File.open. (dart:io/file_impl.dart:381) #2 _FileStream._start.onOpenFile (dart:io/file_impl.dart:153) [Immich_log_2023-12-20T161140.487950.csv](https://github.com/immich-app/immich/files/13732268/Immich_log_2023-12-20T161140.487950.csv)
Uberpainer commented 5 months ago

Has anyone found a workaround or solution on this?