immich-app / immich

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

iOS Backup stuck on group of images #10396

Open RichFoley opened 3 weeks ago

RichFoley commented 3 weeks ago

The bug

While trying to sync iOS library, the backup gets stuck on an image. There appears to be a group of images from ~2015 that will not upload. I can delete the image from my iOS photo roll and backup will restart and get stuck on the next image in the series.

Example: it will get stuck on img_0001.jpg > delete img_0001.jpg > gets stuck on img_0002.jpg.

There are no errors in the mobile log, but it appears to be syncing changes of albums that are not selected (I have Recents and two others selected): image

Backup screen: image

I've found errors in the server log about a unique key constraint violation, but it appears to happen before the app gets stuck, so I'm not sure if this is related: immich.log

Please let me know what I can do to help investigate. Not sure where to go from here.

The OS that Immich Server is running on

docker compose

Version of Immich Server

1.106.4

Version of Immich Mobile App

1.106.3 build.160

Platform with the issue

Your docker-compose.yml content

name: immich

services:
  immich-server:
    container_name: immich_server
    image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
    # extends:
    #   file: hwaccel.transcoding.yml
    #   service: cpu # set to one of [nvenc, quicksync, rkmpp, vaapi, vaapi-wsl] for accelerated transcoding
    volumes:
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
      - /etc/localtime:/etc/localtime:ro
    env_file:
      - .env
    ports:
      - 2283:3001
    depends_on:
      - redis
      - database
    restart: always

  immich-machine-learning:
    container_name: immich_machine_learning
    # For hardware acceleration, add one of -[armnn, cuda, openvino] to the image tag.
    # Example tag: ${IMMICH_VERSION:-release}-cuda
    image: ghcr.io/immich-app/immich-machine-learning:${IMMICH_VERSION:-release}-cuda
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: 1
              capabilities:
                - gpu
    # extends: # uncomment this section for hardware acceleration - see https://immich.app/docs/features/ml-hardware-acceleration
    #   file: hwaccel.ml.yml
    #   service: cpu # set to one of [armnn, cuda, openvino, openvino-wsl] for accelerated inference - use the `-wsl` version for WSL2 where applicable
    volumes:
      - model-cache:/cache
    env_file:
      - .env
    restart: always

  redis:
    container_name: immich_redis
    image: docker.io/redis:6.2-alpine@sha256:d6c2911ac51b289db208767581a5d154544f2b2fe4914ea5056443f62dc6e900
    healthcheck:
      test: redis-cli ping || exit 1
    restart: always
 database:
    container_name: immich_postgres
    image: docker.io/tensorchord/pgvecto-rs:pg14-v0.2.0@sha256:90724186f0a3517cf6914295b5ab410db9ce23190a2d9d0b9dd6463e3fa298f0
    environment:
      POSTGRES_PASSWORD: ${DB_PASSWORD}
      POSTGRES_USER: ${DB_USERNAME}
      POSTGRES_DB: ${DB_DATABASE_NAME}
      POSTGRES_INITDB_ARGS: '--data-checksums'
    volumes:
      - ${DB_DATA_LOCATION}:/var/lib/postgresql/data
    healthcheck:
      test: pg_isready --dbname='${DB_DATABASE_NAME}' || exit 1; Chksum="$$(psql --dbname='${DB_DATABASE_NAME}' --username='${DB_USERNAME}' --tuples-only --no->      interval: 5m
     # start_interval: 30s
      start_period: 5m
    command: ["postgres", "-c" ,"shared_preload_libraries=vectors.so", "-c", 'search_path="$$user", public, vectors', "-c", "logging_collector=on", "-c", "max_>
    restart: always

  tunnel:
    image: cloudflare/cloudflared:latest
    command: tunnel --no-autoupdate run --token ${cftoken}    restart: always
    container_name: immich_tunnel
    depends_on:
      - immich-server

volumes:
  model-cache:

Your .env content

UPLOAD_LOCATION=/the_quad/immich
DB_DATA_LOCATION=./postgres
TZ=America/New_York

IMMICH_VERSION=release

DB_PASSWORD=1234-(jk)

DB_USERNAME=postgres
DB_DATABASE_NAME=immich

Reproduction steps

1. sync iOS photos (I assume it's something specific to my files)

Relevant log output

immich_server            | [Nest] 17  - 06/16/2024, 9:08:19 AM   ERROR [Api:AssetMediaService~0oqf2fi4] Error uploading file QueryFailedError: duplicate key value violates unique constraint "UQ_16294b83fa8c0149719a1f631ef"
immich_server            | QueryFailedError: duplicate key value violates unique constraint "UQ_16294b83fa8c0149719a1f631ef"
immich_server            |     at PostgresQueryRunner.query (/usr/src/app/node_modules/typeorm/driver/postgres/PostgresQueryRunner.js:219:19)
immich_server            |     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
immich_server            |     at async InsertQueryBuilder.execute (/usr/src/app/node_modules/typeorm/query-builder/InsertQueryBuilder.js:106:33)
immich_server            |     at async SubjectExecutor.executeInsertOperations (/usr/src/app/node_modules/typeorm/persistence/SubjectExecutor.js:260:42)
immich_server            |     at async SubjectExecutor.execute (/usr/src/app/node_modules/typeorm/persistence/SubjectExecutor.js:92:9)
immich_server            |     at async EntityPersistExecutor.execute (/usr/src/app/node_modules/typeorm/persistence/EntityPersistExecutor.js:140:21)
immich_server            |     at async AssetMediaService.create (/usr/src/app/dist/services/asset-media.service.js:290:23)
immich_server            |     at async AssetMediaService.uploadAsset (/usr/src/app/dist/services/asset-media.service.js:131:27)
immich_server            |     at async AssetMediaController.uploadAsset (/usr/src/app/dist/controllers/asset-media.controller.js:39:29)
immich_server            | [Nest] 17  - 06/16/2024, 9:08:19 AM   ERROR [Api:QueryFailedError: duplicate key value violates unique constraint "UQ_16294b83fa8c0149719a1f631ef"
immich_server            |     at PostgresQueryRunner.query (/usr/src/app/node_modules/typeorm/driver/postgres/PostgresQueryRunner.js:219:19)
immich_server            |     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
immich_server            |     at async InsertQueryBuilder.execute (/usr/src/app/node_modules/typeorm/query-builder/InsertQueryBuilder.js:106:33)
immich_server            |     at async SubjectExecutor.executeInsertOperations (/usr/src/app/node_modules/typeorm/persistence/SubjectExecutor.js:260:42)
immich_server            |     at async SubjectExecutor.execute (/usr/src/app/node_modules/typeorm/persistence/SubjectExecutor.js:92:9)
immich_server            |     at async EntityPersistExecutor.execute (/usr/src/app/node_modules/typeorm/persistence/EntityPersistExecutor.js:140:21)
immich_server            |     at async AssetMediaService.create (/usr/src/app/dist/services/asset-media.service.js:290:23)
immich_server            |     at async AssetMediaService.uploadAsset (/usr/src/app/dist/services/asset-media.service.js:131:27)
immich_server            |     at async AssetMediaController.uploadAsset (/usr/src/app/dist/controllers/asset-media.controller.js:39:29)~0oqf2fi4] Failed to upload asset
immich_server            | [Nest] 17  - 06/16/2024, 9:08:19 AM   ERROR [Api:QueryFailedError: duplicate key value violates unique constraint "UQ_16294b83fa8c0149719a1f631ef"
immich_server            |     at PostgresQueryRunner.query (/usr/src/app/node_modules/typeorm/driver/postgres/PostgresQueryRunner.js:219:19)
immich_server            |     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
immich_server            |     at async InsertQueryBuilder.execute (/usr/src/app/node_modules/typeorm/query-builder/InsertQueryBuilder.js:106:33)
immich_server            |     at async SubjectExecutor.executeInsertOperations (/usr/src/app/node_modules/typeorm/persistence/SubjectExecutor.js:260:42)
immich_server            |     at async SubjectExecutor.execute (/usr/src/app/node_modules/typeorm/persistence/SubjectExecutor.js:92:9)
immich_server            |     at async EntityPersistExecutor.execute (/usr/src/app/node_modules/typeorm/persistence/EntityPersistExecutor.js:140:21)
immich_server            |     at async AssetMediaService.create (/usr/src/app/dist/services/asset-media.service.js:290:23)
immich_server            |     at async AssetMediaService.uploadAsset (/usr/src/app/dist/services/asset-media.service.js:131:27)
immich_server            |     at async AssetMediaController.uploadAsset (/usr/src/app/dist/controllers/asset-media.controller.js:39:29)~0oqf2fi4] QueryFailedError: duplicate key value violates unique constraint "UQ_16294b83fa8c0149719a1f631ef"

Additional information

No response

alextremblay commented 2 weeks ago

I'm having a similar (same?) issue:

same behaviour and error message on server, same server version and deployment model

the only difference is that i'm running ios client v1.106.4 rather than v1.106.3, and in client logs I'm seeing "Failed to hash file ..." warnings for all of these images that fail to upload

Immich_log_2024-06-19T09:59:46.028639.log

alextremblay commented 4 days ago

Update: running v1.107.0 on client and server, issue resolved itself

I don't see anything in the changelog directly related to this, so I'm not sure how the issue resolved itself, but I'me happy to see that it did 😄