100% swap memory used #3293

Closed
opened 2026-02-05 08:09:15 +03:00 by OVERLORD · 0 comments
Owner

Originally created by @GrumpyMeow on GitHub (May 26, 2024).

The bug

Hi!
I'm running Immich in a LXC container on Proxmox. Everything seems to be working correctly.
But the "SWAP usage" of the container has a constant value of +/- 100%, while the "Memory usage" of the container is around +/- 10%. I would expect SWAP memory only to be used when the Memory usage is high.
Is this an issue? Or is it related to running the Immich-Docker-containers in an LXC-container?
I've done some experimentation and can see that running the "Facial recognition" triggers the 100% SWAP memory usage within a few seconds.

Situation after running 2 days

image

Output of Docker compose stats:
image

root@immich:/opt/immich-app# ps -aux
USER         PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root           1  0.0  0.1 168932  7680 ?        Ss   May23   0:43 /sbin/init
root          55  0.0  0.2  41220 11396 ?        Ss   May23   0:01 /lib/systemd/systemd-journald
root          92  0.0  0.0   5868  3072 ?        Ss   May23   0:00 dhclient -4 -v -i -pf /run/dhclient.eth0.pid -lf /var/lib/dhcp/dhclient.eth0.leases -I -df /var/lib/dhcp/dhclient6.eth0.leases eth0
systemd+      97  0.0  0.0  17996  3712 ?        Ss   May23   0:00 /lib/systemd/systemd-networkd
root         118  0.0  0.0   3600  1920 ?        Ss   May23   0:00 /usr/sbin/cron -f
message+     119  0.0  0.0   9252  1920 ?        Ss   May23   0:00 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only
root         131  0.0  0.0  16548  3456 ?        Ss   May23   0:00 /lib/systemd/systemd-logind
root         151  0.0  0.0   2516  1664 pts/0    Ss+  May23   0:00 /sbin/agetty -o -p -- \u --noclear --keep-baud - 115200,38400,9600 linux
root         152  0.0  0.0   6120  2560 pts/1    Ss   May23   0:00 /bin/login -p --
root         153  0.0  0.0   2516  1536 pts/2    Ss+  May23   0:00 /sbin/agetty -o -p -- \u --noclear - linux
root         154  0.0  0.0  15412  3200 ?        Ss   May23   0:00 sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups
root         169  0.0  1.3 2866024 57196 ?       Ssl  May23   8:56 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
root         333  0.0  0.0  42652  2708 ?        Ss   May23   0:01 /usr/lib/postfix/sbin/master -w
root         477  0.0  0.1 1236216 7692 ?        Sl   May23   0:18 /usr/bin/containerd-shim-runc-v2 -namespace moby -id c28787a7b4cd0551d13fa2db5e1d782f72cfde111afac7bb2458279ff4a4bd9b -address /run/containerd/containerd.sock
999          532  0.0  0.1 204344  5604 ?        Ssl  May23  17:38 redis-server *:6379
root         543  0.0  0.1 1236472 7960 ?        Sl   May23   0:16 /usr/bin/containerd-shim-runc-v2 -namespace moby -id be7b9de1298d55d48b9e737c7fe0aba149d45ba85db8b984fb491dd64c2862fe -address /run/containerd/containerd.sock
999          604  0.0  0.1 225220  7808 ?        Ss   May23   0:13 postgres -c shared_preload_libraries=vectors.so -c search_path="$user", public, vectors
999          861  0.0  0.8 2392680 36104 ?       Ssl  May23  64:38 postgres: vectors 
999          862  0.0  0.4 225364 17856 ?        Ss   May23   0:01 postgres: checkpointer 
999          863  0.0  0.7 225220 31296 ?        Ss   May23   0:04 postgres: background writer 
999          864  0.0  0.0 225220  3136 ?        Ss   May23   1:10 postgres: walwriter 
999          865  0.0  0.1 225900  6080 ?        Ss   May23   0:05 postgres: autovacuum launcher 
999          866  0.0  0.0  79956  2112 ?        Ss   May23   0:26 postgres: stats collector 
999          867  0.0  0.0 225652  3392 ?        Ss   May23   0:00 postgres: logical replication launcher 
root      275336  0.0  0.1  10308  4864 pts/1    S    May24   0:00 -bash
root      275966  0.0  0.5 2243252 22224 ?       Ssl  May24   3:46 /usr/bin/containerd
root      278166  0.0  0.0 1672076 1536 ?        Sl   May24   0:00 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 2283 -container-ip 172.18.0.5 -container-port 3001
root      278173  0.0  0.0 1745808 1280 ?        Sl   May24   0:00 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 2283 -container-ip 172.18.0.5 -container-port 3001
root      278188  0.0  0.1 1236536 7400 ?        Sl   May24   0:54 /usr/bin/containerd-shim-runc-v2 -namespace moby -id b81fb9d86f7c7ac8b419dcaf420d104c3738da2edb61df0aee0d0794ed9a223b -address /run/containerd/containerd.sock
root      278214  0.0  0.1 1236472 7396 ?        Sl   May24   0:56 /usr/bin/containerd-shim-runc-v2 -namespace moby -id 93366ca23f4e353db064e05d1538124bfff37f0c2edf67db175f08dfc5b39603 -address /run/containerd/containerd.sock
root      278234  0.0  0.1 1236536 7528 ?        Sl   May24   0:55 /usr/bin/containerd-shim-runc-v2 -namespace moby -id dbe04095189c7bb40b6b27f423b51f9e3f334ca78d55de35ce5b0c115961cb7e -address /run/containerd/containerd.sock
root      278253  0.0  0.0   2472   128 ?        Ss   May24   0:06 tini -- ./start.sh
root      278270  0.0  0.0   2472   256 ?        Ss   May24   0:06 tini -- /bin/bash start.sh microservices
root      278278  0.0  0.0   2472   512 ?        Ss   May24   0:06 tini -- /bin/bash start.sh immich
root      278357  0.0  0.0   2576   128 ?        S    May24   0:00 sh ./start.sh
root      278360  0.0  2.7 12772624 116916 ?     Sl   May24  24:17 immich
root      278361  0.0  2.8 12367792 117516 ?     Sl   May24   4:01 immich
root      278362  0.0  0.0 391084  3456 ?        S    May24   0:23 /opt/venv/bin/python /opt/venv/bin/gunicorn app.main:app -k app.config.CustomUvicornWorker -b [::]:3003 -w 1 -t 120 --log-config-json log_conf.json --graceful-timeout 0
root      278384  0.0  0.2 1089580 9748 ?        Sl   May24   4:08 /opt/venv/bin/python /opt/venv/bin/gunicorn app.main:app -k app.config.CustomUvicornWorker -b [::]:3003 -w 1 -t 120 --log-config-json log_conf.json --graceful-timeout 0
999       278407  0.0  0.1 226164  7120 ?        Ss   May24   0:11 postgres: postgres immich 172.18.0.6(39696) idle
999       278408  0.0  0.2 226268  9040 ?        Ss   May24   0:00 postgres: postgres immich 172.18.0.6(39708) idle
999       278412  0.0  0.1 226164  6864 ?        Ss   May24   0:11 postgres: postgres immich 172.18.0.5(57858) idle
999       590526  0.0  1.6 230696 69452 ?        Ss   00:03   2:49 postgres: postgres immich 172.18.0.6(35382) idle
postfix   712306  0.0  0.0  43052  3712 ?        S    10:55   0:00 pickup -l -t unix -u -c
postfix   712307  0.0  0.0  43096  3840 ?        S    10:55   0:00 qmgr -l -t unix -u
999       716428  0.0  3.1 227408 132932 ?       Ss   11:17   0:00 postgres: postgres immich 172.18.0.5(55570) idle
root      717615  0.0  0.1   9476  4864 pts/1    R+   11:22   0:00 ps -aux

Output of top -o %MEM:
image

The OS that Immich Server is running on

Debian GNU/Linux 12 (bookworm)

Version of Immich Server

v1.105.1

Version of Immich Mobile App

N/A

Platform with the issue

  • Server
  • Web
  • Mobile

Your docker-compose.yml content

name: immich

services:
  immich-server:
    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
      - /etc/localtime:/etc/localtime:ro
      - ${EXTERNAL_PATH}:/usr/src/app/external
    env_file:
      - .env
    ports:
      - 2283:3001
    depends_on:
      - redis
      - database
    restart: always

  immich-microservices:
    container_name: immich_microservices
    image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
    extends: # uncomment this section for hardware acceleration - see https://immich.app/docs/features/hardware-transcoding
      file: hwaccel.transcoding.yml
      service: vaapi 
    command: ['start.sh', 'microservices']
    volumes:
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
      - /etc/localtime:/etc/localtime:ro
      - ${EXTERNAL_PATH}:/usr/src/app/external
    env_file:
      - .env
    depends_on:
      - redis
      - database
    restart: always

  immich-machine-learning:
    container_name: immich_machine_learning
    image: ghcr.io/immich-app/immich-machine-learning:${IMMICH_VERSION:-release}
    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:84882e87b54734154586e5f8abd4dce69fe7311315e2fc6d67c29614c8de2672
    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:
      - ${DB_DATA_LOCATION}:/var/lib/postgresql/data
    restart: always

volumes:
  model-cache:

Your .env content

UPLOAD_LOCATION=./library
DB_DATA_LOCATION=./postgres
EXTERNAL_PATH=/mnt/fotos
IMMICH_VERSION=main
DB_PASSWORD=postgres
DB_USERNAME=postgres
DB_DATABASE_NAME=immich

Reproduction steps

Run Immich in a Proxmox LXC container.

Relevant log output

### Situation after doing `docker compose pull` and `docker compose up -d`

After a `docker compose pull` and `docker compose up -d`, i see a much lower usage:
![image](https://github.com/immich-app/immich/assets/12073499/fb8ecf65-63eb-4f9a-95c8-41433c732852)
![image](https://github.com/immich-app/immich/assets/12073499/4d76a78c-9da4-46e0-97b6-52c4eca7c86d)

![image](https://github.com/immich-app/immich/assets/12073499/2d7e844f-c19a-43c9-ad4b-31a802ff5dfe)


### When running jobs
When  running the "Library" and "Facial recognition" jobs, i see this in `docker compose logs -f`:
* `ERROR:  duplicate key value violates unique constraint "UQ_assets_owner_library_checksum"`
* `ERROR [ImmichMicroservices] [JobService] QueryFailedError: duplicate key value violates unique constraint "UQ_assets_owner_library_checksum"`


immich_postgres          | 2024-05-26 11:46:53.970 UTC [8892] ERROR:  duplicate key value violates unique constraint "UQ_assets_owner_library_checksum"
immich_postgres          | 2024-05-26 11:46:53.970 UTC [8892] DETAIL:  Key ("ownerId", "libraryId", checksum)=(643856d6-9be7-483b-b8b8-2e94565d2919, 9598ac59-0e75-42b7-808f-f3c933cea73e, \x763b3f9d9ff0f1ab1bd22e144b4bbba426a7c4cf) already exists.
immich_postgres          | 2024-05-26 11:46:53.970 UTC [8892] STATEMENT:  INSERT INTO "assets"("id", "deviceAssetId", "ownerId", "libraryId", "deviceId", "type", "originalPath", "previewPath", "thumbnailPath", "thumbhash", "encodedVideoPath", "createdAt", "updatedAt", "deletedAt", "fileCreatedAt", "localDateTime", "fileModifiedAt", "isFavorite", "isArchived", "isExternal", "isOffline", "checksum", "duration", "isVisible", "livePhotoVideoId", "originalFileName", "sidecarPath", "stackId", "duplicateId") VALUES (DEFAULT, $1, $2, $3, $4, $5, $6, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, $7, $8, $9, DEFAULT, DEFAULT, $10, DEFAULT, $11, DEFAULT, DEFAULT, DEFAULT, $12, $13, DEFAULT, DEFAULT) RETURNING "id", "thumbnailPath", "encodedVideoPath", "createdAt", "updatedAt", "deletedAt", "isFavorite", "isArchived", "isExternal", "isOffline", "isVisible"
immich_microservices     | [Nest] 7  - 05/26/2024, 11:46:53 AM   ERROR [ImmichMicroservices] [JobService] Unable to run job handler (library/library-refresh-asset): QueryFailedError: duplicate key value violates unique constraint "UQ_assets_owner_library_checksum"
immich_microservices     | [Nest] 7  - 05/26/2024, 11:46:53 AM   ERROR [ImmichMicroservices] [JobService] QueryFailedError: duplicate key value violates unique constraint "UQ_assets_owner_library_checksum"
immich_microservices     |     at PostgresQueryRunner.query (/usr/src/app/node_modules/typeorm/driver/postgres/PostgresQueryRunner.js:219:19)
immich_microservices     |     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
immich_microservices     |     at async InsertQueryBuilder.execute (/usr/src/app/node_modules/typeorm/query-builder/InsertQueryBuilder.js:106:33)
immich_microservices     |     at async SubjectExecutor.executeInsertOperations (/usr/src/app/node_modules/typeorm/persistence/SubjectExecutor.js:260:42)
immich_microservices     |     at async SubjectExecutor.execute (/usr/src/app/node_modules/typeorm/persistence/SubjectExecutor.js:92:9)
immich_microservices     |     at async EntityPersistExecutor.execute (/usr/src/app/node_modules/typeorm/persistence/EntityPersistExecutor.js:140:21)
immich_microservices     |     at async LibraryService.handleAssetRefresh (/usr/src/app/dist/services/library.service.js:382:32)
immich_microservices     |     at async /usr/src/app/dist/services/job.service.js:148:36
immich_microservices     |     at async Worker.processJob (/usr/src/app/node_modules/bullmq/dist/cjs/classes/worker.js:394:28)
immich_microservices     |     at async Worker.retryIfFailed (/usr/src/app/node_modules/bullmq/dist/cjs/classes/worker.js:581:24)
immich_microservices     | [Nest] 7  - 05/26/2024, 11:46:53 AM   ERROR [ImmichMicroservices] [JobService] Object:
immich_microservices     | {
immich_microservices     |   "id": "9598ac59-0e75-42b7-808f-f3c933cea73e",
immich_microservices     |   "assetPath": "/usr/src/app/external/0000 Uploads/iPhone Tanya/202009/IMG_4408.HEIC",
immich_microservices     |   "ownerId": "643856d6-9be7-483b-b8b8-2e94565d2919",
immich_microservices     |   "force": false
immich_microservices     | }
immich_microservices     | 
immich_server            | [Nest] 7  - 05/26/2024, 11:46:57 AM     LOG [ImmichServer] [EventRepository] Websocket Connect:    Bh8MLUb8J-WRcd1hAAAF
immich_server            | [Nest] 7  - 05/26/2024, 11:47:10 AM     LOG [ImmichServer] [EventRepository] Websocket Disconnect: Bh8MLUb8J-WRcd1hAAAF
immich_server            | [Nest] 7  - 05/26/2024, 11:47:11 AM     LOG [ImmichServer] [EventRepository] Websocket Connect:    RtzKkKJkStXibXwnAAAH
immich_redis             | 1:M 26 May 2024 11:47:35.092 * 10000 changes in 60 seconds. Saving...
immich_redis             | 1:M 26 May 2024 11:47:35.098 * Background saving started by pid 825
immich_redis             | 825:C 26 May 2024 11:47:36.262 * DB saved on disk
immich_redis             | 825:C 26 May 2024 11:47:36.267 * RDB: 5 MB of memory used by copy-on-write
immich_redis             | 1:M 26 May 2024 11:47:36.308 * Background saving terminated with success


### Additional information

_No response_
Originally created by @GrumpyMeow on GitHub (May 26, 2024). ### The bug Hi! I'm running Immich in a LXC container on Proxmox. Everything seems to be working correctly. But the "SWAP usage" of the container has a constant value of +/- 100%, while the "Memory usage" of the container is around +/- 10%. I would expect SWAP memory only to be used when the Memory usage is high. Is this an issue? Or is it related to running the Immich-Docker-containers in an LXC-container? I've done some experimentation and can see that running the "Facial recognition" triggers the 100% SWAP memory usage within a few seconds. ### Situation after running 2 days ![image](https://github.com/immich-app/immich/assets/12073499/77c3f794-c80b-4cbf-a217-5f30e3dd9ec6) Output of `Docker compose stats`: ![image](https://github.com/immich-app/immich/assets/12073499/0a9eda83-c880-4243-9568-8ea6fca8b581) ``` root@immich:/opt/immich-app# ps -aux USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 1 0.0 0.1 168932 7680 ? Ss May23 0:43 /sbin/init root 55 0.0 0.2 41220 11396 ? Ss May23 0:01 /lib/systemd/systemd-journald root 92 0.0 0.0 5868 3072 ? Ss May23 0:00 dhclient -4 -v -i -pf /run/dhclient.eth0.pid -lf /var/lib/dhcp/dhclient.eth0.leases -I -df /var/lib/dhcp/dhclient6.eth0.leases eth0 systemd+ 97 0.0 0.0 17996 3712 ? Ss May23 0:00 /lib/systemd/systemd-networkd root 118 0.0 0.0 3600 1920 ? Ss May23 0:00 /usr/sbin/cron -f message+ 119 0.0 0.0 9252 1920 ? Ss May23 0:00 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only root 131 0.0 0.0 16548 3456 ? Ss May23 0:00 /lib/systemd/systemd-logind root 151 0.0 0.0 2516 1664 pts/0 Ss+ May23 0:00 /sbin/agetty -o -p -- \u --noclear --keep-baud - 115200,38400,9600 linux root 152 0.0 0.0 6120 2560 pts/1 Ss May23 0:00 /bin/login -p -- root 153 0.0 0.0 2516 1536 pts/2 Ss+ May23 0:00 /sbin/agetty -o -p -- \u --noclear - linux root 154 0.0 0.0 15412 3200 ? Ss May23 0:00 sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups root 169 0.0 1.3 2866024 57196 ? Ssl May23 8:56 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock root 333 0.0 0.0 42652 2708 ? Ss May23 0:01 /usr/lib/postfix/sbin/master -w root 477 0.0 0.1 1236216 7692 ? Sl May23 0:18 /usr/bin/containerd-shim-runc-v2 -namespace moby -id c28787a7b4cd0551d13fa2db5e1d782f72cfde111afac7bb2458279ff4a4bd9b -address /run/containerd/containerd.sock 999 532 0.0 0.1 204344 5604 ? Ssl May23 17:38 redis-server *:6379 root 543 0.0 0.1 1236472 7960 ? Sl May23 0:16 /usr/bin/containerd-shim-runc-v2 -namespace moby -id be7b9de1298d55d48b9e737c7fe0aba149d45ba85db8b984fb491dd64c2862fe -address /run/containerd/containerd.sock 999 604 0.0 0.1 225220 7808 ? Ss May23 0:13 postgres -c shared_preload_libraries=vectors.so -c search_path="$user", public, vectors 999 861 0.0 0.8 2392680 36104 ? Ssl May23 64:38 postgres: vectors 999 862 0.0 0.4 225364 17856 ? Ss May23 0:01 postgres: checkpointer 999 863 0.0 0.7 225220 31296 ? Ss May23 0:04 postgres: background writer 999 864 0.0 0.0 225220 3136 ? Ss May23 1:10 postgres: walwriter 999 865 0.0 0.1 225900 6080 ? Ss May23 0:05 postgres: autovacuum launcher 999 866 0.0 0.0 79956 2112 ? Ss May23 0:26 postgres: stats collector 999 867 0.0 0.0 225652 3392 ? Ss May23 0:00 postgres: logical replication launcher root 275336 0.0 0.1 10308 4864 pts/1 S May24 0:00 -bash root 275966 0.0 0.5 2243252 22224 ? Ssl May24 3:46 /usr/bin/containerd root 278166 0.0 0.0 1672076 1536 ? Sl May24 0:00 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 2283 -container-ip 172.18.0.5 -container-port 3001 root 278173 0.0 0.0 1745808 1280 ? Sl May24 0:00 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 2283 -container-ip 172.18.0.5 -container-port 3001 root 278188 0.0 0.1 1236536 7400 ? Sl May24 0:54 /usr/bin/containerd-shim-runc-v2 -namespace moby -id b81fb9d86f7c7ac8b419dcaf420d104c3738da2edb61df0aee0d0794ed9a223b -address /run/containerd/containerd.sock root 278214 0.0 0.1 1236472 7396 ? Sl May24 0:56 /usr/bin/containerd-shim-runc-v2 -namespace moby -id 93366ca23f4e353db064e05d1538124bfff37f0c2edf67db175f08dfc5b39603 -address /run/containerd/containerd.sock root 278234 0.0 0.1 1236536 7528 ? Sl May24 0:55 /usr/bin/containerd-shim-runc-v2 -namespace moby -id dbe04095189c7bb40b6b27f423b51f9e3f334ca78d55de35ce5b0c115961cb7e -address /run/containerd/containerd.sock root 278253 0.0 0.0 2472 128 ? Ss May24 0:06 tini -- ./start.sh root 278270 0.0 0.0 2472 256 ? Ss May24 0:06 tini -- /bin/bash start.sh microservices root 278278 0.0 0.0 2472 512 ? Ss May24 0:06 tini -- /bin/bash start.sh immich root 278357 0.0 0.0 2576 128 ? S May24 0:00 sh ./start.sh root 278360 0.0 2.7 12772624 116916 ? Sl May24 24:17 immich root 278361 0.0 2.8 12367792 117516 ? Sl May24 4:01 immich root 278362 0.0 0.0 391084 3456 ? S May24 0:23 /opt/venv/bin/python /opt/venv/bin/gunicorn app.main:app -k app.config.CustomUvicornWorker -b [::]:3003 -w 1 -t 120 --log-config-json log_conf.json --graceful-timeout 0 root 278384 0.0 0.2 1089580 9748 ? Sl May24 4:08 /opt/venv/bin/python /opt/venv/bin/gunicorn app.main:app -k app.config.CustomUvicornWorker -b [::]:3003 -w 1 -t 120 --log-config-json log_conf.json --graceful-timeout 0 999 278407 0.0 0.1 226164 7120 ? Ss May24 0:11 postgres: postgres immich 172.18.0.6(39696) idle 999 278408 0.0 0.2 226268 9040 ? Ss May24 0:00 postgres: postgres immich 172.18.0.6(39708) idle 999 278412 0.0 0.1 226164 6864 ? Ss May24 0:11 postgres: postgres immich 172.18.0.5(57858) idle 999 590526 0.0 1.6 230696 69452 ? Ss 00:03 2:49 postgres: postgres immich 172.18.0.6(35382) idle postfix 712306 0.0 0.0 43052 3712 ? S 10:55 0:00 pickup -l -t unix -u -c postfix 712307 0.0 0.0 43096 3840 ? S 10:55 0:00 qmgr -l -t unix -u 999 716428 0.0 3.1 227408 132932 ? Ss 11:17 0:00 postgres: postgres immich 172.18.0.5(55570) idle root 717615 0.0 0.1 9476 4864 pts/1 R+ 11:22 0:00 ps -aux ``` Output of `top -o %MEM`: ![image](https://github.com/immich-app/immich/assets/12073499/93e7e77a-e73b-40b3-9e93-7fa30690520b) ### The OS that Immich Server is running on Debian GNU/Linux 12 (bookworm) ### Version of Immich Server v1.105.1 ### Version of Immich Mobile App N/A ### Platform with the issue - [X] Server - [ ] Web - [ ] Mobile ### Your docker-compose.yml content ```YAML name: immich services: immich-server: 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 - /etc/localtime:/etc/localtime:ro - ${EXTERNAL_PATH}:/usr/src/app/external env_file: - .env ports: - 2283:3001 depends_on: - redis - database restart: always immich-microservices: container_name: immich_microservices image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release} extends: # uncomment this section for hardware acceleration - see https://immich.app/docs/features/hardware-transcoding file: hwaccel.transcoding.yml service: vaapi command: ['start.sh', 'microservices'] volumes: - ${UPLOAD_LOCATION}:/usr/src/app/upload - /etc/localtime:/etc/localtime:ro - ${EXTERNAL_PATH}:/usr/src/app/external env_file: - .env depends_on: - redis - database restart: always immich-machine-learning: container_name: immich_machine_learning image: ghcr.io/immich-app/immich-machine-learning:${IMMICH_VERSION:-release} 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:84882e87b54734154586e5f8abd4dce69fe7311315e2fc6d67c29614c8de2672 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: - ${DB_DATA_LOCATION}:/var/lib/postgresql/data restart: always volumes: model-cache: ``` ### Your .env content ```Shell UPLOAD_LOCATION=./library DB_DATA_LOCATION=./postgres EXTERNAL_PATH=/mnt/fotos IMMICH_VERSION=main DB_PASSWORD=postgres DB_USERNAME=postgres DB_DATABASE_NAME=immich ``` ### Reproduction steps ```bash Run Immich in a Proxmox LXC container. ``` ### Relevant log output ```shell ### Situation after doing `docker compose pull` and `docker compose up -d` After a `docker compose pull` and `docker compose up -d`, i see a much lower usage: ![image](https://github.com/immich-app/immich/assets/12073499/fb8ecf65-63eb-4f9a-95c8-41433c732852) ![image](https://github.com/immich-app/immich/assets/12073499/4d76a78c-9da4-46e0-97b6-52c4eca7c86d) ![image](https://github.com/immich-app/immich/assets/12073499/2d7e844f-c19a-43c9-ad4b-31a802ff5dfe) ### When running jobs When running the "Library" and "Facial recognition" jobs, i see this in `docker compose logs -f`: * `ERROR: duplicate key value violates unique constraint "UQ_assets_owner_library_checksum"` * `ERROR [ImmichMicroservices] [JobService] QueryFailedError: duplicate key value violates unique constraint "UQ_assets_owner_library_checksum"` immich_postgres | 2024-05-26 11:46:53.970 UTC [8892] ERROR: duplicate key value violates unique constraint "UQ_assets_owner_library_checksum" immich_postgres | 2024-05-26 11:46:53.970 UTC [8892] DETAIL: Key ("ownerId", "libraryId", checksum)=(643856d6-9be7-483b-b8b8-2e94565d2919, 9598ac59-0e75-42b7-808f-f3c933cea73e, \x763b3f9d9ff0f1ab1bd22e144b4bbba426a7c4cf) already exists. immich_postgres | 2024-05-26 11:46:53.970 UTC [8892] STATEMENT: INSERT INTO "assets"("id", "deviceAssetId", "ownerId", "libraryId", "deviceId", "type", "originalPath", "previewPath", "thumbnailPath", "thumbhash", "encodedVideoPath", "createdAt", "updatedAt", "deletedAt", "fileCreatedAt", "localDateTime", "fileModifiedAt", "isFavorite", "isArchived", "isExternal", "isOffline", "checksum", "duration", "isVisible", "livePhotoVideoId", "originalFileName", "sidecarPath", "stackId", "duplicateId") VALUES (DEFAULT, $1, $2, $3, $4, $5, $6, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, $7, $8, $9, DEFAULT, DEFAULT, $10, DEFAULT, $11, DEFAULT, DEFAULT, DEFAULT, $12, $13, DEFAULT, DEFAULT) RETURNING "id", "thumbnailPath", "encodedVideoPath", "createdAt", "updatedAt", "deletedAt", "isFavorite", "isArchived", "isExternal", "isOffline", "isVisible" immich_microservices | [Nest] 7 - 05/26/2024, 11:46:53 AM ERROR [ImmichMicroservices] [JobService] Unable to run job handler (library/library-refresh-asset): QueryFailedError: duplicate key value violates unique constraint "UQ_assets_owner_library_checksum" immich_microservices | [Nest] 7 - 05/26/2024, 11:46:53 AM ERROR [ImmichMicroservices] [JobService] QueryFailedError: duplicate key value violates unique constraint "UQ_assets_owner_library_checksum" immich_microservices | at PostgresQueryRunner.query (/usr/src/app/node_modules/typeorm/driver/postgres/PostgresQueryRunner.js:219:19) immich_microservices | at process.processTicksAndRejections (node:internal/process/task_queues:95:5) immich_microservices | at async InsertQueryBuilder.execute (/usr/src/app/node_modules/typeorm/query-builder/InsertQueryBuilder.js:106:33) immich_microservices | at async SubjectExecutor.executeInsertOperations (/usr/src/app/node_modules/typeorm/persistence/SubjectExecutor.js:260:42) immich_microservices | at async SubjectExecutor.execute (/usr/src/app/node_modules/typeorm/persistence/SubjectExecutor.js:92:9) immich_microservices | at async EntityPersistExecutor.execute (/usr/src/app/node_modules/typeorm/persistence/EntityPersistExecutor.js:140:21) immich_microservices | at async LibraryService.handleAssetRefresh (/usr/src/app/dist/services/library.service.js:382:32) immich_microservices | at async /usr/src/app/dist/services/job.service.js:148:36 immich_microservices | at async Worker.processJob (/usr/src/app/node_modules/bullmq/dist/cjs/classes/worker.js:394:28) immich_microservices | at async Worker.retryIfFailed (/usr/src/app/node_modules/bullmq/dist/cjs/classes/worker.js:581:24) immich_microservices | [Nest] 7 - 05/26/2024, 11:46:53 AM ERROR [ImmichMicroservices] [JobService] Object: immich_microservices | { immich_microservices | "id": "9598ac59-0e75-42b7-808f-f3c933cea73e", immich_microservices | "assetPath": "/usr/src/app/external/0000 Uploads/iPhone Tanya/202009/IMG_4408.HEIC", immich_microservices | "ownerId": "643856d6-9be7-483b-b8b8-2e94565d2919", immich_microservices | "force": false immich_microservices | } immich_microservices | immich_server | [Nest] 7 - 05/26/2024, 11:46:57 AM LOG [ImmichServer] [EventRepository] Websocket Connect: Bh8MLUb8J-WRcd1hAAAF immich_server | [Nest] 7 - 05/26/2024, 11:47:10 AM LOG [ImmichServer] [EventRepository] Websocket Disconnect: Bh8MLUb8J-WRcd1hAAAF immich_server | [Nest] 7 - 05/26/2024, 11:47:11 AM LOG [ImmichServer] [EventRepository] Websocket Connect: RtzKkKJkStXibXwnAAAH immich_redis | 1:M 26 May 2024 11:47:35.092 * 10000 changes in 60 seconds. Saving... immich_redis | 1:M 26 May 2024 11:47:35.098 * Background saving started by pid 825 immich_redis | 825:C 26 May 2024 11:47:36.262 * DB saved on disk immich_redis | 825:C 26 May 2024 11:47:36.267 * RDB: 5 MB of memory used by copy-on-write immich_redis | 1:M 26 May 2024 11:47:36.308 * Background saving terminated with success ``` ``` ### Additional information _No response_
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: immich-app/immich#3293