immich-app / immich

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

Server won't process uploads after double upload #10305

Closed fraddy91 closed 4 months ago

fraddy91 commented 4 months ago

The bug

I've got setup on unraid's docker the latest version 1.106.4. I've uploaded bunch of photos and they won't be processed. Maybe the problem is because I've uploaded them once but the upload sigh wasn't changed, so I thought there was some problem and uploaded them again. Now photos won't be processed, I've got some duplicate key db errors: Screenshot_2024-06-14-08-47-08-289_com android chrome-edit Jobs are stuck in waiting state: image

The OS that Immich Server is running on

Unraid 6.11.5

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

services:
  immich-server:
    container_name: immich_server
    image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
    devices:
      - /dev/dri:/dev/dri
    command: [ "start.sh", "immich" ]
    volumes:
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
      - ${THUMB_LOCATION}:/usr/src/app/upload/thumbs
      - /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
    image: ghcr.io/immich-app/immich-machine-learning:${IMMICH_VERSION:-release}
    volumes:
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
      - ${MCFOLDER}:/cache
    env_file:
      - .env
    restart: always

  redis:
    container_name: immich_redis
    image: redis:6.2-alpine@sha256:70a7a5b641117670beae0d80658430853896b5ef269ccf00d1827427e3263fa3
    command: redis-server /usr/local/etc/redis/redis.conf
    volumes:
      - ${RDCONF}:/usr/local/etc/redis/redis.conf
    restart: always

  database:
    container_name: immich_postgres
    image: tensorchord/pgvecto-rs:pg14-v0.2.0@sha256:90724186f0a3517cf6914295b5ab410db9ce23190a2d9d0b9dd6463e3fa298f0
    env_file:
      - .env
    environment:
      POSTGRES_PASSWORD: ${DB_PASSWORD}
      POSTGRES_USER: ${DB_USERNAME}
      POSTGRES_DB: ${DB_DATABASE_NAME}
      PG_DATA: /var/lib/postgresql/data
    volumes:
      - ${PGFOLDER}:/var/lib/postgresql/data
    restart: always

Your .env content

DB_HOSTNAME=immich_postgres
DB_USERNAME=*my db username*
DB_PASSWORD=*my db pass*
DB_DATABASE_NAME=*db name*

REDIS_HOSTNAME=immich_redis

UPLOAD_LOCATION=/mnt/user/Docker/Immich
THUMB_LOCATION=/mnt/docker/appdata/immich/thumbs

TYPESENSE_API_KEY= *my API key*
TYPESENSE_ENABLED=true

PUBLIC_LOGIN_PAGE_MESSAGE=
IMMICH_MACHINE_LEARNING_ENABLED=true

IMMICH_VERSION=release

RDCONF=/mnt/docker/appdata/immich/redis/redis.conf
PGFOLDER=/mnt/docker/appdata/immich/pgdata/
MCFOLDER=/mnt/docker/appdata/immich/model_cache/

Reproduction steps

1.Upload bunch of files
2.Files has no uploaded signs
3.Upload same bunch of files again
4. No thumbnails generated, jobs won't be processed, errors in server logs

Relevant log output

46 UTC [2703] ERROR: duplicate key value violates unique constraint "UQ_assets_owner_checksum" immich_postgres

2024-06-13 18:13:26.7

46 UTC [2703] DETAIL: Key ("ownerId", checksum) =(c75dc807-7025-4919-89ef-e93b8f837a51, \x97bbc4cd955514e46646e010af467af40177a59a) already exists.

immich_postgres

2024-06-13 18:13:26.7

46 UTC [2703] STATEMENT: INSERT INTO "assets" ("id", "deviceAssetId", "ownerId", "libraryId", "deviceId", "type", "originalPath", "previewPath"."thumbnailPath", "thumbhash", "encoded VideoPath". "createdAt", "updatedAt", "deletedAt", "fileCreatedAt", "localDateTime", "fileModifiedAt", "isFavorite", "isArchived", "isExternal", "isOffline", "checksum", "duration", "isVisible", "livePhotoVideold". "originalFileName". "sidecarPath","stackId", "duplicateId") VALUES (DEFAULT, $1,$2. $3. $4 $5, $6. DEFAULT, DEFAULT. DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, $7, $8, $9, $10. $11. DEFAULT, $12. $13. $14. $15. DEFAULT.16, DEFAULT, DEFAULT, DEFAULT) RETURNING "id",$thumbnailPath", "encodedVideoPath", "createdAt","updatedAt", "deletedAt", "isFavorite", "isArchived", "isExternal", "isOffline", "isVisible"

Additional information

No response

fraddy91 commented 4 months ago

Nevermind, seems all the problems was because of this line was not removed: - command: ['start.sh', 'immich'] Hope this will help some other inattentive ppl as I am...