immich-app / immich

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

Some untracked images after upgrade 1.94.1 -> 1.95.1 #7355

Closed malconsei closed 8 months ago

malconsei commented 8 months ago

The bug

I upgraded as per instructions from 1.94.1 to 1.95.1 (with postgres superuser) and everything ran smoothly. I then went to the Repair page and found 15 untracked images (5 in library/admin and 10 in thumbs), which I'm sure weren't reported a few days ago. I checked the db backups, and those images were still referenced in the assets table, even in the latest table dump that I've taken right before the upgrade. Turns out the 10 untracked snapshots were of the 5 untracked images.

A line from the untracked list:

/usr/src/app/upload/library/admin/2023/2023-12-26/IMG_20231226_220100.jpg

And its excerpt from the db dump:

91838504-5eb9-4c81-9797-8c15d5b5f578    1000019995      645d35ed-e8a2-48c1-9d57-03ff4ddb53fe    91d4f57038c56c261584c6c43fbbed4f6422f0deb4bb237566e2409d21a89ee9       IMAGE   upload/library/admin/2023/2023-12-26/IMG_20231226_220100.jpg    upload/thumbs/645d35ed-e8a2-48c1-9d57-03ff4ddb53fe/91/83/91838504-5eb9-4c81-9797-8c15d5b5f578.jpeg     2023-12-26 21:01:00+00  2023-12-26 21:01:03+00  f       \N      upload/thumbs/645d35ed-e8a2-48c1-9d57-03ff4ddb53fe/91/83/91838504-5eb9-4c81-9797-8c15d5b5f578.webp     \N      \\x0f20dd5c913493f63037024d05c40fd762932b38     t              \N      2024-02-10 19:02:08.806636+00   2023-12-26 21:01:10.889533+00   t       IMG_20231226_220100     \N      f       \\xa2180a0580d95877af778884899866a8a0d71610bc  f       f61e233e-14df-42ba-aba2-064174cbdb64    f       \N      2023-12-26 22:01:00+00  \N

I'm not familiar enough with the schema and the untracked detection logic to tell if there are other checks playing a role. If needed I can dig deeper in the db dump.

As a note, my library (but not the thumbnails) are mounted from b2/s3 via rclone.

The OS that Immich Server is running on

nixos 23.11

Version of Immich Server

v1.95.1

Version of Immich Mobile App

v1.95.0

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:
      - /data/volumes/immich/upload:/usr/src/app/upload
    env_file:
      - .env
    depends_on:
      - redis
      - database
    ports:
      - 2283:3001
    restart: unless-stopped
    user: nobody
    read_only: true

  immich-microservices:
    container_name: immich_microservices
    image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
    command: [ "start.sh", "microservices" ]
    volumes:
      - /data/volumes/immich/upload:/usr/src/app/upload
      - geocoding:/usr/src/app/.reverse-geocoding-dump/
    env_file:
      - .env
    depends_on:
      - redis
      - database
    restart: unless-stopped
    user: nobody
    read_only: true

  immich-machine-learning:
    container_name: immich_machine_learning
    image: ghcr.io/immich-app/immich-machine-learning:${IMMICH_VERSION:-release}
    volumes:
      - ml_cache:/cache
    tmpfs:
      - /tmp
    env_file:
      - .env
    restart: unless-stopped
    read_only: true
    user: nobody

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

  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}
    volumes:
      - /data/volumes/immich/pgsql:/var/lib/postgresql/data
    tmpfs:
      - /var/run/postgresql/
        #networks:
        #  - immich
    restart: unless-stopped
    read_only: true

volumes:
  immich-models:
  geocoding:
  nginx_conf:
  ml_cache:
  ml_matplotlib:

Your .env content

UPLOAD_LOCATION=./library
BASEDIR=/home/containers/immich-data
IMMICH_VERSION=release
TYPESENSE_API_KEY=X
DB_PASSWORD=X
DB_HOSTNAME=immich_postgres
DB_USERNAME=X
DB_DATABASE_NAME=X
REDIS_HOSTNAME=immich_redis

Reproduction steps

The one-shot incident was:

1. Upgrade 1.94.1 -> 1.95.1
2. Go to Repair page

Additional information

No response

Vyerni commented 8 months ago

To add further clarification, I just tested from backups, it's the upgrade from 1.95.0 to 1.95.1.

So the question becomes, were the files untracked previously and only being brought to our attention now, or have the files BECOME untracked?

michelheusschen commented 8 months ago

Do the untracked files belong to archived assets?

malconsei commented 8 months ago

Do the untracked files belong to archived assets?

Personally, I can check in 12 hours.

I've never willingly archived anything, but last week I did notice some archived images - I dismissed the episode as some clumsy tapping on the ui from my end. I don't remember if by any chance they were the same pics. After notifcing I've unarchived them, so I'm pretty sure nothing was archived yesterday at the time of the upgrade.

lukanowa commented 8 months ago

I have over 800 untracked (mostly upload) but in upload there is only empty folders. I deleted all folders from upload but still the same number of untracked.

malconsei commented 8 months ago

Do the untracked files belong to archived assets?

You're right @michelheusschen, they were archived, so this is a duplicate of #7333 . Thanks! (As for my previous answer, I probably misremebrered unarchiving them.)