immich-app / immich

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

Existing external library files aren't being scanned. #13058

Closed itzTheMeow closed 29 minutes ago

itzTheMeow commented 19 hours ago

The bug

After upgrading from v1.115, my external library assets show up in trash as offline. However, they can not be restored and still show as offline after a library re-scan. The server was upgraded with these assets offline already, that could be the issue. When clicking restore all on the webpage it says "restored 0 assets" and reloads the view with the offline assets still there.

Creating a new external library with the same import paths recognizes the files correctly. If I add new assets to the existing external library location they are recognized properly as well.

The OS that Immich Server is running on

Ubuntu 22.04.4

Version of Immich Server

v1.116.2

Version of Immich Mobile App

N/A

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}
    volumes:
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
      - /etc/localtime:/etc/localtime:ro
      - /home/pcloud/Media/Images:/mnt/images
    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}
    # 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: registry.hub.docker.com/library/redis:6.2-alpine@sha256:51d6c56749a4243096327e3fb964a48ed92254357108449cb6e23999c37773c5
    restart: always

  database:
    container_name: immich_postgres
    image: registry.hub.docker.com/tensorchord/pgvecto-rs:pg14-v0.2.0@sha256:90724186f0a3517cf6914295b5ab410db9ce23190a2d9d0b9dd6463e3fa298f0
    environment:
      POSTGRES_PASSWORD: ${DB_PASSWORD}
      POSTGRES_USER: ${DB_USERNAME}
      POSTGRES_DB: ${DB_DATABASE_NAME}
    volumes:
      - pgdata:/var/lib/postgresql/data
    restart: always

volumes:
  pgdata:
  model-cache:

Your .env content

# The location where your uploaded files are stored
UPLOAD_LOCATION=./lib

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

# Connection secret for postgres. You should change it to a random password
DB_PASSWORD=x

# 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. Have an existing external library on 1.115 (with offline assets)
  2. upgrade to 1.116
  3. assets are offline still and can not be restored or re-scanned in

Relevant log output

immich_server            | [Nest] 17  - 09/30/2024, 5:51:03 PM   DEBUG [Api:LoggingInterceptor~d4wpc37b] POST /api/libraries/03bda257-ca7a-4052-86a2-afba662363e5/scan 204 7.50ms 172.71.158.185
immich_server            | [Nest] 7  - 09/30/2024, 5:51:03 PM     LOG [Microservices:LibraryService] Refreshing library 03bda257-ca7a-4052-86a2-afba662363e5 for new assets
immich_server            | [Nest] 7  - 09/30/2024, 5:51:03 PM     LOG [Microservices:LibraryService] Scanning library 03bda257-ca7a-4052-86a2-afba662363e5 for removed assets
immich_server            | [Nest] 7  - 09/30/2024, 5:51:03 PM   DEBUG [Microservices:LibraryService] Discovered 7 asset(s) in library 03bda257-ca7a-4052-86a2-afba662363e5...
immich_server            | [Nest] 7  - 09/30/2024, 5:51:03 PM   DEBUG [Microservices:LibraryService] Queued check of 7 asset(s) in 
library 03bda257-ca7a-4052-86a2-afba662363e5...
immich_server            | [Nest] 7  - 09/30/2024, 5:51:03 PM     LOG [Microservices:LibraryService] Finished queueing check of 7 a
 for library 03bda257-ca7a-4052-86a2-afba662363e5
immich_server            | [Nest] 7  - 09/30/2024, 5:51:03 PM   DEBUG [Microservices:LibraryService] Discovered 1234 asset(s) on disk for library 03bda257-ca7a-4052-86a2-afba662363e5...
immich_server            | [Nest] 7  - 09/30/2024, 5:51:04 PM VERBOSE [Microservices:LibraryService] Queued scan of 1234 crawled asset(s) in library 03bda257-ca7a-4052-86a2-afba662363e5...
immich_server            | [Nest] 7  - 09/30/2024, 5:51:04 PM   DEBUG [Microservices:LibraryService] Finished queueing scan of 1234
 assets on disk for library 03bda257-ca7a-4052-86a2-afba662363e5
immich_redis             | 1:M 30 Sep 2024 17:51:04.046 * 10000 changes in 60 seconds. Saving...
immich_redis             | 1:M 30 Sep 2024 17:51:04.046 * Background saving started by pid 24
immich_redis             | 24:C 30 Sep 2024 17:51:04.060 * DB saved on disk
immich_redis             | 24:C 30 Sep 2024 17:51:04.060 * RDB: 1 MB of memory used by copy-on-write
immich_redis             | 1:M 30 Sep 2024 17:51:04.147 * Background saving terminated with success

Additional information

regarding the log, the scanned library already has 7 non-offline assets in, and more that show up as offline log is taken when scanning the existing external library

itzTheMeow commented 19 hours ago

Relevant images: IMG_2082 IMG_2083 IMG_2084

zackpollard commented 19 hours ago

I'll take a look at this tomorrow, will try upgrading after setting some assets offline and see what happens.