Unable to run job handler (faceDetection/queue-face-detection) #2748

Closed
opened 2026-02-05 06:58:43 +03:00 by OVERLORD · 1 comment
Owner

Originally created by @MSommer95 on GitHub (Apr 4, 2024).

The bug

Hey,
I tried to fiddle around with the Face Detection und Recognition parameters, because some faces (although to the human eye they are very clearly faces) just werent being recognised as such.

I lowered the min detection score and raised the max recognition distance to 1 and let that run over night but wasnt happy with the results so I lowered the max recognition distance to 0.6 again.

My settings now:
Facial Recognition Model: buffalo_l
Min detection score: 0,6
Max recognition distance: 0,6
Min recognized faces: 2

But this time the Face Detection job just woulnt run.
When I checked the logs for immich_microservices it shows this error:

[Nest] 7  - 04/04/2024, 9:44:53 AM   ERROR [JobService] Unable to run job handler (faceDetection/queue-face-detection): QueryFailedError: range end index 682321 out of range for slice of length 524280
[Nest] 7  - 04/04/2024, 9:44:53 AM   ERROR [JobService] QueryFailedError: range end index 682321 out of range for slice of length 524280
    at PostgresQueryRunner.query (/usr/src/app/node_modules/typeorm/driver/postgres/PostgresQueryRunner.js:219:19)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async PostgresQueryRunner.commitTransaction (/usr/src/app/node_modules/typeorm/driver/postgres/PostgresQueryRunner.js:148:13)
    at async EntityPersistExecutor.execute (/usr/src/app/node_modules/typeorm/persistence/EntityPersistExecutor.js:146:21)
    at async PersonRepository.delete (/usr/src/app/dist/repositories/person.repository.js:48:9)
    at async PersonService.delete (/usr/src/app/dist/services/person.service.js:209:9)
    at async PersonService.deleteAllPeople (/usr/src/app/dist/services/person.service.js:215:13)
    at async PersonService.handleQueueDetectFaces (/usr/src/app/dist/services/person.service.js:229:13)
    at async /usr/src/app/dist/services/job.service.js:147:36
    at async Worker.processJob (/usr/src/app/node_modules/bullmq/dist/cjs/classes/worker.js:394:28)
[Nest] 7  - 04/04/2024, 9:44:53 AM   ERROR [JobService] Object:
{
  "force": true
}

The postgres DB container shows the following error:

2024-04-04 09:44:53.000 CEST [46] ERROR:  range end index 682321 out of range for slice of length 524280
2024-04-04 09:44:53.000 CEST [46] STATEMENT:  COMMIT
2024-04-04 09:44:53.000 CEST [46] WARNING:  there is no transaction in progress

I am not really sure what is causing this error or how to fix it if I am honest.

Is there a way to maybe clear every previously made face detection from the postgres db?

The OS that Immich Server is running on

Docker

Version of Immich Server

v1.100.0

Version of Immich Mobile App

v1.100.0

Platform with the issue

  • Server
  • Web
  • Mobile

Your docker-compose.yml content

#version: '3.9'
services:

######################################### Immich #########################################

  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
      - /homiepool/data/backups/Fotoarchiv:/mnt/media/Fotoarchiv:ro
    ports:
      - "2283:3001"
      - "9230:9230"
      - "8088:8081"
    env_file:
      - .env
    environment:
      - NODE_ENV=production
    depends_on:
      - redis
      - database
    restart: unless-stopped
    deploy:
      resources:
        limits:
          memory: 550m
        reservations:
          memory: 150m

  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
      - /homiepool/data/backups/Fotoarchiv:/mnt/media/Fotoarchiv:ro
    env_file:
      - .env
    environment:
      - NODE_ENV=production
    depends_on:
      - redis
      - database
    restart: unless-stopped
    ports:
      - "8087:8081"
    deploy:
      resources:
        limits:
          memory: 2g
        reservations:
          memory: 250m

  immich-machine-learning:
    container_name: immich_machine_learning
    image: ghcr.io/immich-app/immich-machine-learning:release
      #mem_limit: "4g"
    ports:
      - "3013:3003"
    volumes:
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
      - ./data/immich/model-cache:/cache
      - /homiepool/data/backups/Fotoarchiv:/mnt/media/Fotoarchiv:ro
    env_file:
      - .env
    environment:
      - NODE_ENV=production
    restart: unless-stopped
    deploy:
      resources:
        limits:
          memory: 2g
        reservations:
          memory: 1g

  redis:
    container_name: immich_redis
    image: redis:6.2
    restart: unless-stopped
    ports:
      - "5432:5432"
    deploy:
      resources:
        limits:
          memory: 400m
        reservations:
          memory: 10m


  database:
    container_name: postgres
    image: tensorchord/pgvecto-rs:pg14-v0.2.0
    env_file:
      - .env
    environment:
      POSTGRES_PASSWORD: ${DB_PASSWORD}
      POSTGRES_USER: ${DB_USERNAME}
      POSTGRES_DB: ${DB_DATABASE_NAME}
      PG_DATA: /var/lib/postgresql/data
    volumes:
      - ./data/postgres:/var/lib/postgresql/data
    restart: unless-stopped
    deploy:
      resources:
        limits:
          memory: 8g
        reservations:
          memory: 1g

Your .env content

###################################################################################
# Database
###################################################################################

DB_HOSTNAME=postgres
DB_USERNAME=XXXXXXXXX
DB_PASSWORD=XXXXXXXXX
DB_DATABASE_NAME=immich

# Optional Database settings:
# DB_PORT=5432

###################################################################################
# Redis
###################################################################################

REDIS_HOSTNAME=immich_redis

# Optional Redis settings:
# REDIS_PORT=6379
# REDIS_DBINDEX=0
# REDIS_PASSWORD=
# REDIS_SOCKET=

###################################################################################
# Upload File Location
#
# This is the location where uploaded files are stored.
###################################################################################
LOG_LEVEL=debug

UPLOAD_LOCATION=/homiepool/data/immich/data

###################################################################################
# Reverse Geocoding
#
# Reverse geocoding is done locally which has a small impact on memory usage
# This memory usage can be altered by changing the REVERSE_GEOCODING_PRECISION variable
# This ranges from 0-3 with 3 being the most precise
# 3 - Cities > 500 population: ~200MB RAM
# 2 - Cities > 1000 population: ~150MB RAM
# 1 - Cities > 5000 population: ~80MB RAM
# 0 - Cities > 15000 population: ~40MB RAM
####################################################################################

# DISABLE_REVERSE_GEOCODING=false
# REVERSE_GEOCODING_PRECISION=3

####################################################################################
# WEB - Optional
#
# Custom message on the login page, should be written in HTML form.
# For example:
# PUBLIC_LOGIN_PAGE_MESSAGE="This is a demo instance of Immich.<br><br>Email: <i>demo@demo.de</i><br>Password: <i>demo</i>"
####################################################################################

PUBLIC_LOGIN_PAGE_MESSAGE=Hellooo

####################################################################################
# Alternative Service Addresses - Optional
#
# This is an advanced feature for users who may be running their immich services on different hosts.
# It will not change which address or port that services bind to within their containers, but it will change where other services look for their peers.
# Note: immich-microservices is bound to 3002, but no references are made
####################################################################################

IMMICH_WEB_URL=http://192.168.1.85:3010
IMMICH_SERVER_URL=http://192.168.1.85:3011
IMMICH_MACHINE_LEARNING_URL=http://192.168.1.85:3013

Reproduction steps

1. Run the Face Detection job multiple times
2. Change the Face Detection / Recognition settings
3. Rerun the Face Detection job
...

Additional information

No response

Originally created by @MSommer95 on GitHub (Apr 4, 2024). ### The bug Hey, I tried to fiddle around with the Face Detection und Recognition parameters, because some faces (although to the human eye they are very clearly faces) just werent being recognised as such. I lowered the `min detection score` and raised the `max recognition distance` to 1 and let that run over night but wasnt happy with the results so I lowered the `max recognition distance` to 0.6 again. My settings now: **Facial Recognition Model**: buffalo_l **Min detection score**: 0,6 **Max recognition distance**: 0,6 **Min recognized faces**: 2 But this time the `Face Detection` job just woulnt run. When I checked the logs for `immich_microservices ` it shows this error: ``` [Nest] 7 - 04/04/2024, 9:44:53 AM ERROR [JobService] Unable to run job handler (faceDetection/queue-face-detection): QueryFailedError: range end index 682321 out of range for slice of length 524280 [Nest] 7 - 04/04/2024, 9:44:53 AM ERROR [JobService] QueryFailedError: range end index 682321 out of range for slice of length 524280 at PostgresQueryRunner.query (/usr/src/app/node_modules/typeorm/driver/postgres/PostgresQueryRunner.js:219:19) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async PostgresQueryRunner.commitTransaction (/usr/src/app/node_modules/typeorm/driver/postgres/PostgresQueryRunner.js:148:13) at async EntityPersistExecutor.execute (/usr/src/app/node_modules/typeorm/persistence/EntityPersistExecutor.js:146:21) at async PersonRepository.delete (/usr/src/app/dist/repositories/person.repository.js:48:9) at async PersonService.delete (/usr/src/app/dist/services/person.service.js:209:9) at async PersonService.deleteAllPeople (/usr/src/app/dist/services/person.service.js:215:13) at async PersonService.handleQueueDetectFaces (/usr/src/app/dist/services/person.service.js:229:13) at async /usr/src/app/dist/services/job.service.js:147:36 at async Worker.processJob (/usr/src/app/node_modules/bullmq/dist/cjs/classes/worker.js:394:28) [Nest] 7 - 04/04/2024, 9:44:53 AM ERROR [JobService] Object: { "force": true } ``` The postgres DB container shows the following error: ``` 2024-04-04 09:44:53.000 CEST [46] ERROR: range end index 682321 out of range for slice of length 524280 2024-04-04 09:44:53.000 CEST [46] STATEMENT: COMMIT 2024-04-04 09:44:53.000 CEST [46] WARNING: there is no transaction in progress ``` I am not really sure what is causing this error or how to fix it if I am honest. Is there a way to maybe clear every previously made face detection from the postgres db? ### The OS that Immich Server is running on Docker ### Version of Immich Server v1.100.0 ### Version of Immich Mobile App v1.100.0 ### Platform with the issue - [X] Server - [ ] Web - [ ] Mobile ### Your docker-compose.yml content ```YAML #version: '3.9' services: ######################################### Immich ######################################### 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 - /homiepool/data/backups/Fotoarchiv:/mnt/media/Fotoarchiv:ro ports: - "2283:3001" - "9230:9230" - "8088:8081" env_file: - .env environment: - NODE_ENV=production depends_on: - redis - database restart: unless-stopped deploy: resources: limits: memory: 550m reservations: memory: 150m 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 - /homiepool/data/backups/Fotoarchiv:/mnt/media/Fotoarchiv:ro env_file: - .env environment: - NODE_ENV=production depends_on: - redis - database restart: unless-stopped ports: - "8087:8081" deploy: resources: limits: memory: 2g reservations: memory: 250m immich-machine-learning: container_name: immich_machine_learning image: ghcr.io/immich-app/immich-machine-learning:release #mem_limit: "4g" ports: - "3013:3003" volumes: - ${UPLOAD_LOCATION}:/usr/src/app/upload - ./data/immich/model-cache:/cache - /homiepool/data/backups/Fotoarchiv:/mnt/media/Fotoarchiv:ro env_file: - .env environment: - NODE_ENV=production restart: unless-stopped deploy: resources: limits: memory: 2g reservations: memory: 1g redis: container_name: immich_redis image: redis:6.2 restart: unless-stopped ports: - "5432:5432" deploy: resources: limits: memory: 400m reservations: memory: 10m database: container_name: postgres image: tensorchord/pgvecto-rs:pg14-v0.2.0 env_file: - .env environment: POSTGRES_PASSWORD: ${DB_PASSWORD} POSTGRES_USER: ${DB_USERNAME} POSTGRES_DB: ${DB_DATABASE_NAME} PG_DATA: /var/lib/postgresql/data volumes: - ./data/postgres:/var/lib/postgresql/data restart: unless-stopped deploy: resources: limits: memory: 8g reservations: memory: 1g ``` ### Your .env content ```Shell ################################################################################### # Database ################################################################################### DB_HOSTNAME=postgres DB_USERNAME=XXXXXXXXX DB_PASSWORD=XXXXXXXXX DB_DATABASE_NAME=immich # Optional Database settings: # DB_PORT=5432 ################################################################################### # Redis ################################################################################### REDIS_HOSTNAME=immich_redis # Optional Redis settings: # REDIS_PORT=6379 # REDIS_DBINDEX=0 # REDIS_PASSWORD= # REDIS_SOCKET= ################################################################################### # Upload File Location # # This is the location where uploaded files are stored. ################################################################################### LOG_LEVEL=debug UPLOAD_LOCATION=/homiepool/data/immich/data ################################################################################### # Reverse Geocoding # # Reverse geocoding is done locally which has a small impact on memory usage # This memory usage can be altered by changing the REVERSE_GEOCODING_PRECISION variable # This ranges from 0-3 with 3 being the most precise # 3 - Cities > 500 population: ~200MB RAM # 2 - Cities > 1000 population: ~150MB RAM # 1 - Cities > 5000 population: ~80MB RAM # 0 - Cities > 15000 population: ~40MB RAM #################################################################################### # DISABLE_REVERSE_GEOCODING=false # REVERSE_GEOCODING_PRECISION=3 #################################################################################### # WEB - Optional # # Custom message on the login page, should be written in HTML form. # For example: # PUBLIC_LOGIN_PAGE_MESSAGE="This is a demo instance of Immich.<br><br>Email: <i>demo@demo.de</i><br>Password: <i>demo</i>" #################################################################################### PUBLIC_LOGIN_PAGE_MESSAGE=Hellooo #################################################################################### # Alternative Service Addresses - Optional # # This is an advanced feature for users who may be running their immich services on different hosts. # It will not change which address or port that services bind to within their containers, but it will change where other services look for their peers. # Note: immich-microservices is bound to 3002, but no references are made #################################################################################### IMMICH_WEB_URL=http://192.168.1.85:3010 IMMICH_SERVER_URL=http://192.168.1.85:3011 IMMICH_MACHINE_LEARNING_URL=http://192.168.1.85:3013 ``` ### Reproduction steps ```bash 1. Run the Face Detection job multiple times 2. Change the Face Detection / Recognition settings 3. Rerun the Face Detection job ... ``` ### Additional information _No response_
Author
Owner

@mertalev commented on GitHub (Apr 8, 2024):

I think there's some kind of corruption in the face data in the DB. Running face detection on all assets will purge all face / person data, so that should fix it.

@mertalev commented on GitHub (Apr 8, 2024): I think there's some kind of corruption in the face data in the DB. Running face detection on all assets will purge all face / person data, so that should fix it.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: immich-app/immich#2748