immich-app / immich

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

Force Re-scan All library files creates 2 sets of thumbnails #8760

Closed Philshappy closed 7 months ago

Philshappy commented 7 months ago

The bug

Had to perform a Force Re-scan All Library files after installing V1.101.0 due to issues not related to the installation of V1.101 After the Re-scan I had twice as many thumbnails and a huge number of untracked files. It appears that the new thumbnails have a different file name (thumb and preview) at the end. All of my photos are external on a NAS. The thumbnails are local to my server.

The OS that Immich Server is running on

Ubuntu

Version of Immich Server

v1.101

Version of Immich Mobile App

N/A

Platform with the issue

Your docker-compose.yml content

services:
  immich-server:
    container_name: immich_server
    image: ghcr.io/immich-app/immich-server:release
    command: ["start.sh", "immich"]
    volumes:
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
      - /etc/localtime:/etc/localtime:ro
      - /mnt/NAS6602/Photos:/mnt/media/Photos:ro
    env_file:
      - stack.env
    ports:
      - 2283:3001  
    depends_on:
      - redis
      - database
    restart: always

  immich-microservices:
    container_name: immich_microservices
    image: ghcr.io/immich-app/immich-server:release
    command: ["start.sh", "microservices"]
    volumes:
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
      - /etc/localtime:/etc/localtime:ro
      - /mnt/NAS6602/Photos:/mnt/media/Photos:ro
    env_file:
      - stack.env
    depends_on:
      - redis
      - database
    devices:
      - /dev/dri:/dev/dri
    restart: always

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

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

  database:
    container_name: immich_postgres
    image: tensorchord/pgvecto-rs:pg14-v0.2.0
    env_file:
      - stack.env
    environment:
      POSTGRES_PASSWORD: ${DB_PASSWORD}
      POSTGRES_USER: ${DB_USERNAME}
      POSTGRES_DB: ${DB_DATABASE_NAME}
    volumes:
      - /home/phil/Immich/database:/var/lib/postgresql/data
    restart: always

volumes:
  model-cache:

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=/home/phil/Immich

# 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=ABCDEFGGFECBAASCDEFGABCDEFG
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
IMMICH_WEB_URL=http://immich-web:3000
IMMICH_SERVER_URL=http://immich-server:3001

Reproduction steps

1.after upgrading to v1.101 Force Re-scan All Library
2.examine the thumbnails folders to determine if 2 sets of thumbnails exist and select repair to discover untracked files
3.
...

Additional information

No response

rickysarraf commented 7 months ago

I've run into the very same problem. But I am a very first user of immich at version 1.101.

Is there no helper job to do cleanups ?

rickysarraf commented 7 months ago

I've run into the very same problem. But I am a very first user of immich at version 1.101.

Is there no helper job to do cleanups ?

I do see 3 thumbnail folders, of which I suspect 1 folder is an extra one. Is there a way to do the mapping of the libraries to the thumbnail folders ?

Right now, my 2 libraries are:

immich_microservices       | [Nest] 6  - 04/18/2024, 3:28:17 PM     LOG [LibraryService] Refreshing library: 1afb0a02-2446-4ba6-928d-8763a2259a1b
immich_microservices       | [Nest] 6  - 04/18/2024, 3:28:23 PM     LOG [LibraryService] Refreshing library: 290e43e5-95bb-4dad-a73b-d36589f3fb04
immich_microservices       | [Nest] 6  - 04/18/2024, 3:28:26 PM     LOG [MediaService] Successfully generated JPEG image thumbnail for asset 4d0dbf46-ac37-437f-8613-5654346e0825
immich_microservices       | [Nest] 6  - 04/18/2024, 3:28:27 PM     LOG [MediaService] Successfully generated WEBP image thumbnail for asset 4d0dbf46-ac37-437f-8613-5654346e0825
immich_machine_learning    | [04/18/24 15:28:27] INFO     Setting 'ViT-B-32__openai' execution providers to  
immich_machine_learning    |                              ['CPUExecutionProvider'], in descending order of   
immich_machine_learning    |                              preference                                         
immich_machine_learning    | [04/18/24 15:28:29] INFO     Loading clip model 'ViT-B-32__openai' to memory    
Philshappy commented 7 months ago

I do not believe there is a feature to remove the unused assets. Hopefully one will be added in the near future. My thumbnails appeared in the same folder paths, just twice as many at the lowest level. Since v1.101 has a bug with setting up the thumbnail size, i deleted my stuff and started over using a previous version and being cautious not to force a library rescan again.


From: Ritesh Raj Sarraf @.> Sent: Thursday, April 18, 2024 8:32 AM To: immich-app/immich @.> Cc: Philshappy @.>; Author @.> Subject: Re: [immich-app/immich] Force Re-scan All library files creates 2 sets of thumbnails (Issue #8760)

I've run into the very same problem. But I am a very first user of immich at version 1.101.

Is there no helper job to do cleanups ?

I do see 3 thumbnail folders, of which I suspect 1 folder is an extra one. Is there a way to do the mapping of the libraries to the thumbnail folders ?

Right now, my 2 libraries are:

immich_microservices | [Nest] 6 - 04/18/2024, 3:28:17 PM LOG [LibraryService] Refreshing library: 1afb0a02-2446-4ba6-928d-8763a2259a1b immich_microservices | [Nest] 6 - 04/18/2024, 3:28:23 PM LOG [LibraryService] Refreshing library: 290e43e5-95bb-4dad-a73b-d36589f3fb04 immich_microservices | [Nest] 6 - 04/18/2024, 3:28:26 PM LOG [MediaService] Successfully generated JPEG image thumbnail for asset 4d0dbf46-ac37-437f-8613-5654346e0825 immich_microservices | [Nest] 6 - 04/18/2024, 3:28:27 PM LOG [MediaService] Successfully generated WEBP image thumbnail for asset 4d0dbf46-ac37-437f-8613-5654346e0825 immich_machine_learning | [04/18/24 15:28:27] INFO Setting 'ViT-B-32openai' execution providers to immich_machine_learning | ['CPUExecutionProvider'], in descending order of immich_machine_learning | preference immich_machine_learning | [04/18/24 15:28:29] INFO Loading clip model 'ViT-B-32openai' to memory

— Reply to this email directly, view it on GitHubhttps://github.com/immich-app/immich/issues/8760#issuecomment-2064250560, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BDSLPUVQBYKYJFWLTQUEIVTY57RPBAVCNFSM6AAAAABGFDCR7WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANRUGI2TANJWGA. You are receiving this because you authored the thread.Message ID: @.***>

rickysarraf commented 7 months ago

Thanks. I think I can now relate the UUID that is throwaway.

Screenshot_20240419_144544

So this is the library uuid that can be junked. It very well matches with one of the folder names.

 $  ls thumbs/
1395d9a8-aa74-4f96-b148-c3603a99cb1e/  43a6a6b2-6a9a-45d1-ab41-80fd96b2f838/  f2ffdf0e-2103-4b4f-9789-ed084ddece47/
 14:47:30  ॐ ♅ ♄ ⛢  rrs  chutzpah  SSH  usr/local/…/library 
 $  ls encoded-video/
1395d9a8-aa74-4f96-b148-c3603a99cb1e/  43a6a6b2-6a9a-45d1-ab41-80fd96b2f838/  f2ffdf0e-2103-4b4f-9789-ed084ddece47/
 14:47:43  ॐ ♅ ♄ ⛢  rrs  chutzpah  SSH  usr/local/…/library 
rickysarraf commented 7 months ago

One other good thing that immich did was that while it didn't delete the generated library cache (which is a good thing in a way), it did ensure that that content wasn't used in rendering. After all my jobs had completed, this was one big difference I noticed/welcomed.

mertalev commented 7 months ago

Fixed via #9126.