immich-app / immich

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

[BUG] Feature photos for people are changing after updating to 1.90.0 #5540

Closed eygraber closed 11 months ago

eygraber commented 12 months ago

The bug

The feature photos that I set for people are no longer there. Instead there is a different photo from that person being used. It's not for all people, and it didn't seem to happen right after updating, but only after using the website for a little bit.

The OS that Immich Server is running on

Ubuntu 22.04

Version of Immich Server

v1.90.0

Version of Immich Mobile App

v1.90.0

Platform with the issue

Your docker-compose.yml content

version: "3.8"

services:
  immich-server:
    user: 1000:1001
    container_name: immich_server
    image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
    command: [ "start.sh", "immich" ]
    volumes:
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
    env_file:
      - .env
    ports:
      - "2283:3001"
    depends_on:
      - redis
      - database
      - typesense
    restart: always

  immich-microservices:
    user: 1000:1001
    container_name: immich_microservices
    image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
    # extends:
    #   file: hwaccel.yml
    #   service: hwaccel
    command: [ "start.sh", "microservices" ]
    volumes:
      - /disks/storage/immich/volumes/geocoding:/usr/src/app/.reverse-geocoding-dump
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
    env_file:
      - .env
    depends_on:
      - redis
      - database
      - typesense
    restart: always

  immich-machine-learning:
    user: 1000:1001
    container_name: immich_machine_learning
    image: ghcr.io/immich-app/immich-machine-learning:${IMMICH_VERSION:-release}
    volumes:
      - /disks/storage/immich/volumes/model-cache:/cache
    env_file:
      - .env
    restart: always

  typesense:
    container_name: immich_typesense
    image: typesense/typesense:0.24.1@sha256:9bcff2b829f12074426ca044b56160ca9d777a0c488303469143dd9f8259d4dd
    environment:
      - TYPESENSE_API_KEY=${TYPESENSE_API_KEY}
      - TYPESENSE_DATA_DIR=/data
      # remove this to get debug messages
      - GLOG_minloglevel=1
    volumes:
      - /disks/storage/immich/volumes/tsdata:/data
    restart: always

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

  database:
    user: 1000:1001
    container_name: immich_postgres
    image: postgres:14-alpine@sha256:28407a9961e76f2d285dc6991e8e48893503cc3836a4755bbc2d40bcc272a441
    env_file:
      - .env
    environment:
      POSTGRES_PASSWORD: ${DB_PASSWORD}
      POSTGRES_USER: ${DB_USERNAME}
      POSTGRES_DB: ${DB_DATABASE_NAME}
    volumes:
      - /disks/storage/immich/volumes/pgdata:/var/lib/postgresql/data
    restart: always

Your .env content

# You can find documentation for all the supported env variables at https://immich.app/docs/install/environment-variables

PUID=1000
GUID=1001

# The location where your uploaded files are stored
UPLOAD_LOCATION=/disks/storage/immich/library

# 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=...
DB_PASSWORD=...

TZ=America/New_York

# 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

Not fully sure, just noticed that the feature photo changed for some people.

Additional information

No response

martabal commented 12 months ago

Did you re-assign faces ?

eygraber commented 12 months ago

I did with one of them, but I'm not 100% sure of the other (although given the circumstances I probably did)

martabal commented 12 months ago

If you re-assigned the face which is the feature photo of the edited person, yes it's supposed to change the feature photo. You don't want two people having the same feature photo

eygraber commented 12 months ago

I'm not sure I understand. This is what happened

  1. Person A was tagged in a photo they were not in
  2. I reassigned the face in that photo to Person B
  3. Person B's feature photo changed
martabal commented 12 months ago

It means the Person B faceAssetId was set to null :thinking: When was that person created ? If it was a long time ago, I think one release mentioned to re-generate the feature photos to avoid this issue.

eygraber commented 12 months ago

Person B was probably created a couple of months ago. I searched the release notes for "feature photo" and only found two mentions; when the ability to change them was added and something related to websockets. I'd appreciate any more info if someone has :pray:

raisinbear commented 11 months ago

Yeah I noticed the same with following scenario: person wrongfully identified as person „A“, when reassigned to person „B“, the feature photo for „B“ changes to a presumably random one. This process did not alter the feature photo for person „A“ and was not the feature photo for person „A“. Could reproduce this multiple times. Hope this helps! Awesome feature by the way! Thanks so much for the effort @martabal ! 🤩

Edit: Should have read more carefully. The feature photos of the persons in question were set around August. So yeah could be that I missed the release notes saying to re-generate feature photos or plainly ignored that recommendation. Sadly I wasn't able to find it anymore either. I definitely re-ran the generate thumbnails job at some point, though, if that's what it's about. I think that was when the directory layout was changed to subfolders for thumbs.

eygraber commented 11 months ago

@martabal sorry if I misunderstood, but is there anything we can do to prevent this from happening?

jrasm91 commented 11 months ago

We used to set a feature photo and not track what asset it came from. With the recent changes a feature photo has to have a reference back to the asset it came from, otherwise we'll lose it and pick a random one. This is just a problem with how the implementation was originally built and it should not happen on a regular basis.

eygraber commented 11 months ago

Anything I can do to prevent it from happening further, or I just have to deal with it as it happens?

martabal commented 11 months ago

You can set the feature photo with the "Change feature" option on the person page, it will fix the issue. But there's no easy way to know which person has their faceAssetId set to null, you'll have to check in the database yourself

eygraber commented 11 months ago

Got it thanks! Seems like this could be closed then?

eygraber commented 11 months ago

This is still happening on v1.91.4 for people that shouldn't have faceAssetId == null (i.e. I've already set their feature photo recently).

It seems to happen after reassigning a face to that person; is this something that https://github.com/immich-app/immich/pull/5796 addresses, or is there something else going on?

martabal commented 11 months ago

This has nothing to do with this.

Can you make sure you don't have people with faceAssetId set to null with SELECT * FROM "person" WHERE "faceAssetId" IS NULL

eygraber commented 11 months ago

I checked and I have 86 with faceAssetId != null and 255 with faceAssetId == null (this is only for people that have a name; there's 12k more that don't have a name).

For the ones that are null, I've definitely set a feature photo for them recently.

eygraber commented 11 months ago

Also finding that some newly created people have a null faceAssetId. Can this be re-opened, or should I file a new issue?