[BUG] After upgrading to 1.91.0, deadlock in immich_postgresql #1798

Closed
opened 2026-02-05 03:53:06 +03:00 by OVERLORD · 33 comments
Owner

Originally created by @tnys on GitHub (Dec 16, 2023).

The bug

immich_postgresql container log...

2023-12-16 18:57:42.065 UTC [41] FATAL:  the database system is starting up
2023-12-16 18:57:42.099 UTC [1] LOG:  database system is ready to accept connections
2023-12-16 18:57:46.435 UTC [49] ERROR:  deadlock detected
2023-12-16 18:57:46.435 UTC [49] DETAIL:  Process 49 waits for ShareLock on transaction 3012936; blocked by process 48.
	Process 48 waits for AccessExclusiveLock on relation 16911 of database 16384; blocked by process 49.
	Process 49: CREATE EXTENSION IF NOT EXISTS vectors
	Process 48: 
	        ALTER TABLE asset_faces 
	        ALTER COLUMN embedding SET NOT NULL,
	        ALTER COLUMN embedding TYPE vector(512)
2023-12-16 18:57:46.435 UTC [49] HINT:  See server log for query details.
2023-12-16 18:57:46.435 UTC [49] CONTEXT:  while inserting index tuple (0,11) in relation "pg_extension_name_index"
2023-12-16 18:57:46.435 UTC [49] STATEMENT:  CREATE EXTENSION IF NOT EXISTS vectors

The OS that Immich Server is running on

Ubuntu 22.0

Version of Immich Server

v1.91.0

Version of Immich Mobile App

Platform with the issue

  • Server
  • Web
  • Mobile

Your docker-compose.yml content

version: "3.8"

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
      - /media/photos-usb:/media/photos-usb:ro
    ports:
      - 2283:3001
    env_file:
      - .env
    depends_on:
      - redis
      - database
    restart: always

  immich-microservices:
    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:
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
      - /etc/localtime:/etc/localtime:ro
      - /media/photos-usb:/media/photos-usb:ro
    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:
      - /media/photos-usb/immich-model-cache:/cache
      - /media/photos-usb/immich-machine-learning-tmp:/tmp
    env_file:
      - .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.1.11
    env_file:
      - .env
    environment:
      POSTGRES_PASSWORD: ${DB_PASSWORD}
      POSTGRES_USER: ${DB_USERNAME}
      POSTGRES_DB: ${DB_DATABASE_NAME}
    volumes:
      - /media/photos-usb/immich-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

# The location where your uploaded files are stored
UPLOAD_LOCATION=/media/photos-usb/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=some-random-text
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

Reproduction steps

Upgrade from 1.90.x to 1.91.0

Additional information

No response

Originally created by @tnys on GitHub (Dec 16, 2023). ### The bug immich_postgresql container log... ``` 2023-12-16 18:57:42.065 UTC [41] FATAL: the database system is starting up 2023-12-16 18:57:42.099 UTC [1] LOG: database system is ready to accept connections 2023-12-16 18:57:46.435 UTC [49] ERROR: deadlock detected 2023-12-16 18:57:46.435 UTC [49] DETAIL: Process 49 waits for ShareLock on transaction 3012936; blocked by process 48. Process 48 waits for AccessExclusiveLock on relation 16911 of database 16384; blocked by process 49. Process 49: CREATE EXTENSION IF NOT EXISTS vectors Process 48: ALTER TABLE asset_faces ALTER COLUMN embedding SET NOT NULL, ALTER COLUMN embedding TYPE vector(512) 2023-12-16 18:57:46.435 UTC [49] HINT: See server log for query details. 2023-12-16 18:57:46.435 UTC [49] CONTEXT: while inserting index tuple (0,11) in relation "pg_extension_name_index" 2023-12-16 18:57:46.435 UTC [49] STATEMENT: CREATE EXTENSION IF NOT EXISTS vectors ``` ### The OS that Immich Server is running on Ubuntu 22.0 ### Version of Immich Server v1.91.0 ### Version of Immich Mobile App - ### Platform with the issue - [X] Server - [ ] Web - [ ] Mobile ### Your docker-compose.yml content ```YAML version: "3.8" 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 - /media/photos-usb:/media/photos-usb:ro ports: - 2283:3001 env_file: - .env depends_on: - redis - database restart: always immich-microservices: 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: - ${UPLOAD_LOCATION}:/usr/src/app/upload - /etc/localtime:/etc/localtime:ro - /media/photos-usb:/media/photos-usb:ro 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: - /media/photos-usb/immich-model-cache:/cache - /media/photos-usb/immich-machine-learning-tmp:/tmp env_file: - .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.1.11 env_file: - .env environment: POSTGRES_PASSWORD: ${DB_PASSWORD} POSTGRES_USER: ${DB_USERNAME} POSTGRES_DB: ${DB_DATABASE_NAME} volumes: - /media/photos-usb/immich-pgdata:/var/lib/postgresql/data restart: always ``` ### Your .env content ```Shell # 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=/media/photos-usb/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=some-random-text 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 ``` ### Reproduction steps ```bash Upgrade from 1.90.x to 1.91.0 ``` ### Additional information _No response_
Author
Owner

@alextran1502 commented on GitHub (Dec 16, 2023):

Does the service eventually start up?

@alextran1502 commented on GitHub (Dec 16, 2023): Does the service eventually start up?
Author
Owner

@tnys commented on GitHub (Dec 16, 2023):

No, the last log entry is the one shown in my original bug report:

2023-12-16 18:57:46.435 UTC [49] STATEMENT: CREATE EXTENSION IF NOT EXISTS vectors

@tnys commented on GitHub (Dec 16, 2023): No, the last log entry is the one shown in my original bug report: `2023-12-16 18:57:46.435 UTC [49] STATEMENT: CREATE EXTENSION IF NOT EXISTS vectors `
Author
Owner

@alextran1502 commented on GitHub (Dec 16, 2023):

that is the logs of the postgres's container, do you have logs of the server?

@alextran1502 commented on GitHub (Dec 16, 2023): that is the logs of the postgres's container, do you have logs of the server?
Author
Owner

@tnys commented on GitHub (Dec 16, 2023):

It keeps repeating the entries below...

Error: connect ECONNREFUSED 172.24.0.3:6379
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1595:16) {
  errno: -111,
  code: 'ECONNREFUSED',
  syscall: 'connect',
  address: '172.24.0.3',
  port: 6379
}
Error: connect ECONNREFUSED 172.24.0.3:6379
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1595:16) {
  errno: -111,
  code: 'ECONNREFUSED',
  syscall: 'connect',
  address: '172.24.0.3',
  port: 6379
}

@tnys commented on GitHub (Dec 16, 2023): It keeps repeating the entries below... ``` Error: connect ECONNREFUSED 172.24.0.3:6379 at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1595:16) { errno: -111, code: 'ECONNREFUSED', syscall: 'connect', address: '172.24.0.3', port: 6379 } Error: connect ECONNREFUSED 172.24.0.3:6379 at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1595:16) { errno: -111, code: 'ECONNREFUSED', syscall: 'connect', address: '172.24.0.3', port: 6379 } ```
Author
Owner

@MrMarble commented on GitHub (Dec 16, 2023):

Having the same problem with immich v1.91.1, I'm running immich on k8s and immich-server is not printing any log, container keeps crashing

DeadLock
{
  "level": "info",
  "ts": "2023-12-16T20:39:00+01:00",
  "logger": "postgres",
  "msg": "record",
  "logging_pod": "postgres-1",
  "record": {
    "log_time": "2023-12-16 20:39:00.486 CET",
    "user_name": "postgres",
    "database_name": "immich",
    "process_id": "13351",
    "connection_from": "10.244.2.226:48860",
    "session_id": "657dfcc5.3427",
    "session_line_num": "1",
    "command_tag": "CREATE EXTENSION",
    "session_start_time": "2023-12-16 20:38:45 CET",
    "virtual_transaction_id": "6/4875",
    "transaction_id": "3243533",
    "error_severity": "ERROR",
    "sql_state_code": "40P01",
    "message": "deadlock detected",
    "detail": "Process 13351 waits for ShareLock on transaction 3243532; blocked by process 13350.\nProcess 13350 waits for AccessExclusiveLock on relation 16912 of database 16387; blocked by process 13351.\nProcess 13351: CREATE EXTENSION IF NOT EXISTS vectors\nProcess 13350: \n        ALTER TABLE asset_faces \n        ALTER COLUMN embedding SET NOT NULL,\n        ALTER COLUMN embedding TYPE vector(512)",
    "hint": "See server log for query details.",
    "context": "while inserting index tuple (0,45) in relation \"pg_extension_name_index\"",
    "query": "CREATE EXTENSION IF NOT EXISTS vectors",
    "backend_type": "client backend",
    "query_id": "0"
  }
}
IPC Connection closed
{
  "level": "info",
  "ts": "2023-12-16T21:20:14+01:00",
  "logger": "postgres",
  "msg": "record",
  "logging_pod": "postgres-1",
  "record": {
    "log_time": "2023-12-16 21:20:14.643 CET",
    "user_name": "postgres",
    "database_name": "immich",
    "process_id": "22050",
    "connection_from": "10.244.2.39:49644",
    "session_id": "657e066c.5622",
    "session_line_num": "1",
    "command_tag": "CREATE INDEX",
    "session_start_time": "2023-12-16 21:19:56 CET",
    "virtual_transaction_id": "5/7277",
    "transaction_id": "3245324",
    "error_severity": "ERROR",
    "sql_state_code": "XX000",
    "message": "pgvecto.rs: pgvecto.rs: IPC connection is closed unexpected.\nADVICE: The error is raisen by background worker errors. Please check the full Postgresql log to get more information.",
    "query": "\n      CREATE INDEX IF NOT EXISTS clip_index ON smart_search\n      USING vectors (embedding cosine_ops) WITH (options = $$\n      [indexing.hnsw]\n      m = 16\n      ef_construction = 300\n      $$);",
    "backend_type": "client backend",
    "query_id": "0"
  }
}

Immich v1.90.2 worked fine, here's my helmrelease 1dde083382/kubernetes/home-cluster/apps/default/immich/app/server/helmrelease.yaml

@MrMarble commented on GitHub (Dec 16, 2023): Having the same problem with immich `v1.91.1`, I'm running immich on k8s and `immich-server` is not printing any log, container keeps crashing <details><summary>DeadLock</summary> ```json { "level": "info", "ts": "2023-12-16T20:39:00+01:00", "logger": "postgres", "msg": "record", "logging_pod": "postgres-1", "record": { "log_time": "2023-12-16 20:39:00.486 CET", "user_name": "postgres", "database_name": "immich", "process_id": "13351", "connection_from": "10.244.2.226:48860", "session_id": "657dfcc5.3427", "session_line_num": "1", "command_tag": "CREATE EXTENSION", "session_start_time": "2023-12-16 20:38:45 CET", "virtual_transaction_id": "6/4875", "transaction_id": "3243533", "error_severity": "ERROR", "sql_state_code": "40P01", "message": "deadlock detected", "detail": "Process 13351 waits for ShareLock on transaction 3243532; blocked by process 13350.\nProcess 13350 waits for AccessExclusiveLock on relation 16912 of database 16387; blocked by process 13351.\nProcess 13351: CREATE EXTENSION IF NOT EXISTS vectors\nProcess 13350: \n ALTER TABLE asset_faces \n ALTER COLUMN embedding SET NOT NULL,\n ALTER COLUMN embedding TYPE vector(512)", "hint": "See server log for query details.", "context": "while inserting index tuple (0,45) in relation \"pg_extension_name_index\"", "query": "CREATE EXTENSION IF NOT EXISTS vectors", "backend_type": "client backend", "query_id": "0" } } ``` </details> <details><summary>IPC Connection closed</summary> ```json { "level": "info", "ts": "2023-12-16T21:20:14+01:00", "logger": "postgres", "msg": "record", "logging_pod": "postgres-1", "record": { "log_time": "2023-12-16 21:20:14.643 CET", "user_name": "postgres", "database_name": "immich", "process_id": "22050", "connection_from": "10.244.2.39:49644", "session_id": "657e066c.5622", "session_line_num": "1", "command_tag": "CREATE INDEX", "session_start_time": "2023-12-16 21:19:56 CET", "virtual_transaction_id": "5/7277", "transaction_id": "3245324", "error_severity": "ERROR", "sql_state_code": "XX000", "message": "pgvecto.rs: pgvecto.rs: IPC connection is closed unexpected.\nADVICE: The error is raisen by background worker errors. Please check the full Postgresql log to get more information.", "query": "\n CREATE INDEX IF NOT EXISTS clip_index ON smart_search\n USING vectors (embedding cosine_ops) WITH (options = $$\n [indexing.hnsw]\n m = 16\n ef_construction = 300\n $$);", "backend_type": "client backend", "query_id": "0" } } ``` </details> --- Immich `v1.90.2` worked fine, here's my helmrelease https://github.com/MrMarble/home-ops/blob/1dde083382f9c9cec75627add27c470f6b77ee2e/kubernetes/home-cluster/apps/default/immich/app/server/helmrelease.yaml
Author
Owner

@alextran1502 commented on GitHub (Dec 16, 2023):

@tnys Does restarting the stack help solve the issue?

@alextran1502 commented on GitHub (Dec 16, 2023): @tnys Does restarting the stack help solve the issue?
Author
Owner

@MrMarble commented on GitHub (Dec 17, 2023):

Finally was able to get logs from immich-server after updating to pgvector v13 and got the error mentioned in #5731, but after rolling back to v11 and trying again I'm having the same problem, immich-server is not logging anything and postgres reports a deadlock

[Nest] 7  - 12/16/2023, 10:58:47 PM   ERROR [TypeOrmModule] Unable to connect to the database. Retrying (1)...
QueryFailedError: operator class "cosine_ops" does not exist for access method "vectors"
    at PostgresQueryRunner.query (/usr/src/app/node_modules/typeorm/driver/postgres/PostgresQueryRunner.js:211:19)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async AddCLIPEmbeddingIndex1700713994428.up (/usr/src/app/dist/infra/migrations/1700713994428-AddCLIPEmbeddingIndex.js:9:9)
    at async MigrationExecutor.executePendingMigrations (/usr/src/app/node_modules/typeorm/migration/MigrationExecutor.js:225:17)
    at async DataSource.runMigrations (/usr/src/app/node_modules/typeorm/data-source/DataSource.js:260:35)
    at async DataSource.initialize (/usr/src/app/node_modules/typeorm/data-source/DataSource.js:148:17)

using https://ghcr.io/bo0tzz/cnpgvecto.rs:14.10-v0.1.11

@MrMarble commented on GitHub (Dec 17, 2023): Finally was able to get logs from `immich-server` after updating to pgvector v13 and got the error mentioned in #5731, but after rolling back to v11 and trying again I'm having the same problem, `immich-server` is not logging anything and postgres reports a deadlock ``` [Nest] 7 - 12/16/2023, 10:58:47 PM ERROR [TypeOrmModule] Unable to connect to the database. Retrying (1)... QueryFailedError: operator class "cosine_ops" does not exist for access method "vectors" at PostgresQueryRunner.query (/usr/src/app/node_modules/typeorm/driver/postgres/PostgresQueryRunner.js:211:19) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async AddCLIPEmbeddingIndex1700713994428.up (/usr/src/app/dist/infra/migrations/1700713994428-AddCLIPEmbeddingIndex.js:9:9) at async MigrationExecutor.executePendingMigrations (/usr/src/app/node_modules/typeorm/migration/MigrationExecutor.js:225:17) at async DataSource.runMigrations (/usr/src/app/node_modules/typeorm/data-source/DataSource.js:260:35) at async DataSource.initialize (/usr/src/app/node_modules/typeorm/data-source/DataSource.js:148:17) ``` using https://ghcr.io/bo0tzz/cnpgvecto.rs:14.10-v0.1.11
Author
Owner

@rkkoszewski commented on GitHub (Dec 17, 2023):

Same issue here. Getting a ECONNREFUSED error from the server. Postgres shows the following errors again and again:

2023-12-16 23:00:08.206 UTC [357] STATEMENT: CREATE EXTENSION IF NOT EXISTS vectors 2023-12-16 23:00:11.035 UTC [358] ERROR: could not open extension control file "/usr/local/share/postgresql/extension/vectors.control": No such file or directory 2023-12-16 23:00:11.035 UTC [358] STATEMENT: CREATE EXTENSION IF NOT EXISTS vectors

@rkkoszewski commented on GitHub (Dec 17, 2023): Same issue here. Getting a ECONNREFUSED error from the server. Postgres shows the following errors again and again: `2023-12-16 23:00:08.206 UTC [357] STATEMENT: CREATE EXTENSION IF NOT EXISTS vectors 2023-12-16 23:00:11.035 UTC [358] ERROR: could not open extension control file "/usr/local/share/postgresql/extension/vectors.control": No such file or directory 2023-12-16 23:00:11.035 UTC [358] STATEMENT: CREATE EXTENSION IF NOT EXISTS vectors `
Author
Owner

@rkkoszewski commented on GitHub (Dec 17, 2023):

Ok, this is not a bug. I haven't noticed there were breaking changes in the previous release that is using a different database build in the stack. Following the release notes and redeploying the stack fixed the issue. See: https://github.com/immich-app/immich/releases/tag/v1.91.0

@rkkoszewski commented on GitHub (Dec 17, 2023): Ok, this is not a bug. I haven't noticed there were breaking changes in the previous release that is using a different database build in the stack. Following the release notes and redeploying the stack fixed the issue. See: https://github.com/immich-app/immich/releases/tag/v1.91.0
Author
Owner

@alextran1502 commented on GitHub (Dec 17, 2023):

Please provide the database images you guys use if you are not OP. There are a lot of factors at play if the image you choose is not the correct version as specified in the release note.

@alextran1502 commented on GitHub (Dec 17, 2023): Please provide the database images you guys use if you are not OP. There are a lot of factors at play if the image you choose is not the correct version as specified in the release note.
Author
Owner

@tnys commented on GitHub (Dec 17, 2023):

I'm using tensorchord/pgvecto-rs:pg14-v0.1.11. Is there any way to get around the deadlock manually? Something I can do to resolve?

@tnys commented on GitHub (Dec 17, 2023): I'm using tensorchord/pgvecto-rs:pg14-v0.1.11. Is there any way to get around the deadlock manually? Something I can do to resolve?
Author
Owner

@agross commented on GitHub (Dec 17, 2023):

My upgrade process was this:

  • Started with Immich 1.90.2 and postgres:16-alpine
  • Stopped everything
  • Changed the database to tensorchord/pgvecto-rs:pg16-v0.1.11
  • Started Immich still at 1.90.2, everything was fine
  • Stopped everything
  • Updated the Immich images to 1.91.2 and removed the typesense container
  • Started Immich 1.91.2

During this first start of 1.91.2 this was logged.

immich-db-1                | 2023-12-17 10:43:23.487 CET [145] ERROR:  deadlock detected
immich-db-1                | 2023-12-17 10:43:23.487 CET [145] DETAIL:  Process 145 waits for ShareLock on transaction 1037; blocked by process 144.
immich-db-1                |    Process 144 waits for AccessExclusiveLock on relation 16536 of database 16384; blocked by process 145.
immich-db-1                |    Process 145: CREATE EXTENSION IF NOT EXISTS vectors
immich-db-1                |    Process 144:
immich-db-1                |            ALTER TABLE asset_faces
immich-db-1                |            ALTER COLUMN embedding SET NOT NULL,
immich-db-1                |            ALTER COLUMN embedding TYPE vector(512)
immich-db-1                | 2023-12-17 10:43:23.487 CET [145] HINT:  See server log for query details.
immich-db-1                | 2023-12-17 10:43:23.487 CET [145] CONTEXT:  while inserting index tuple (0,9) in relation "pg_extension_name_index"
immich-db-1                | 2023-12-17 10:43:23.487 CET [145] STATEMENT:  CREATE EXTENSION IF NOT EXISTS vectors
immich-db-1                | 2023-12-17 10:43:30.937 CET [146] ERROR:  column "clipEmbedding" does not exist at character 29
immich-db-1                | 2023-12-17 10:43:30.937 CET [146] STATEMENT:
immich-db-1                |            SELECT CARDINALITY("clipEmbedding"::real[]) as dimsize
immich-db-1                |            FROM smart_info
immich-db-1                |            LIMIT 1
...
immich-server-1  | [Nest] 7  - 12/17/2023, 10:43:34 AM   ERROR [TypeOrmModule] Unable to connect to the database. Retrying (1)...
immich-server-1  | QueryFailedError: deadlock detected
immich-server-1  |     at PostgresQueryRunner.query (/usr/src/app/node_modules/typeorm/driver/postgres/PostgresQueryRunner.js:211:19)
immich-server-1  |     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
immich-server-1  |     at async UsePgVectors1700713871511.up (/usr/src/app/dist/infra/migrations/1700713871511-UsePgVectors.js:19:9)
immich-server-1  |     at async MigrationExecutor.executePendingMigrations (/usr/src/app/node_modules/typeorm/migration/MigrationExecutor.js:225:17)
immich-server-1  |     at async DataSource.runMigrations (/usr/src/app/node_modules/typeorm/data-source/DataSource.js:260:35)
immich-server-1  |     at async DataSource.initialize (/usr/src/app/node_modules/typeorm/data-source/DataSource.js:148:17)
immich-server-1  | [Nest] 7  - 12/17/2023, 10:43:34 AM   ERROR [TypeOrmModule] Unable to connect to the database. Retrying (2)...
immich-server-1  | [Nest] 7  - 12/17/2023, 10:43:34 AM     LOG [InstanceLoader] BullModule dependencies initialized
immich-server-1  | [Nest] 7  - 12/17/2023, 10:43:34 AM     LOG [InstanceLoader] TypeOrmCoreModule dependencies initialized
immich-server-1  | [Nest] 7  - 12/17/2023, 10:43:34 AM     LOG [InstanceLoader] TypeOrmModule dependencies initialized
immich-server-1  | [Nest] 7  - 12/17/2023, 10:43:34 AM     LOG [InstanceLoader] TypeOrmModule dependencies initialized
immich-server-1  | QueryFailedError: column "clipEmbedding" does not exist
immich-server-1  |     at PostgresQueryRunner.query (/usr/src/app/node_modules/typeorm/driver/postgres/PostgresQueryRunner.js:211:19)
immich-server-1  |     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
immich-server-1  |     at async UsePgVectors1700713871511.up (/usr/src/app/dist/infra/migrations/1700713871511-UsePgVectors.js:13:30)
immich-server-1  |     at async MigrationExecutor.executePendingMigrations (/usr/src/app/node_modules/typeorm/migration/MigrationExecutor.js:225:17)
immich-server-1  |     at async DataSource.runMigrations (/usr/src/app/node_modules/typeorm/data-source/DataSource.js:260:35)
immich-server-1  |     at async DataSource.initialize (/usr/src/app/node_modules/typeorm/data-source/DataSource.js:148:17)
immich-server-1  | [Nest] 7  - 12/17/2023, 10:43:34 AM     LOG [InstanceLoader] InfraModule dependencies initialized

I am now wondering if my database schema is broken:

  • The smart_info table has no column named clipEmbedding.

  • The asset_faces's CREATE script is reported as by DbGate (my database query tool of choice):

    CREATE TABLE "public"."asset_faces" ( 
      "assetId" UUID NOT NULL,
      "personId" UUID NULL,
      "embedding" USER-DEFINED NOT NULL,
      ...
    
@agross commented on GitHub (Dec 17, 2023): My upgrade process was this: * Started with Immich 1.90.2 and `postgres:16-alpine` * Stopped everything * Changed the database to `tensorchord/pgvecto-rs:pg16-v0.1.11` * Started Immich still at 1.90.2, everything was fine * Stopped everything * Updated the Immich images to 1.91.2 and removed the typesense container * Started Immich 1.91.2 During this first start of 1.91.2 this was logged. ``` immich-db-1 | 2023-12-17 10:43:23.487 CET [145] ERROR: deadlock detected immich-db-1 | 2023-12-17 10:43:23.487 CET [145] DETAIL: Process 145 waits for ShareLock on transaction 1037; blocked by process 144. immich-db-1 | Process 144 waits for AccessExclusiveLock on relation 16536 of database 16384; blocked by process 145. immich-db-1 | Process 145: CREATE EXTENSION IF NOT EXISTS vectors immich-db-1 | Process 144: immich-db-1 | ALTER TABLE asset_faces immich-db-1 | ALTER COLUMN embedding SET NOT NULL, immich-db-1 | ALTER COLUMN embedding TYPE vector(512) immich-db-1 | 2023-12-17 10:43:23.487 CET [145] HINT: See server log for query details. immich-db-1 | 2023-12-17 10:43:23.487 CET [145] CONTEXT: while inserting index tuple (0,9) in relation "pg_extension_name_index" immich-db-1 | 2023-12-17 10:43:23.487 CET [145] STATEMENT: CREATE EXTENSION IF NOT EXISTS vectors immich-db-1 | 2023-12-17 10:43:30.937 CET [146] ERROR: column "clipEmbedding" does not exist at character 29 immich-db-1 | 2023-12-17 10:43:30.937 CET [146] STATEMENT: immich-db-1 | SELECT CARDINALITY("clipEmbedding"::real[]) as dimsize immich-db-1 | FROM smart_info immich-db-1 | LIMIT 1 ... immich-server-1 | [Nest] 7 - 12/17/2023, 10:43:34 AM ERROR [TypeOrmModule] Unable to connect to the database. Retrying (1)... immich-server-1 | QueryFailedError: deadlock detected immich-server-1 | at PostgresQueryRunner.query (/usr/src/app/node_modules/typeorm/driver/postgres/PostgresQueryRunner.js:211:19) immich-server-1 | at process.processTicksAndRejections (node:internal/process/task_queues:95:5) immich-server-1 | at async UsePgVectors1700713871511.up (/usr/src/app/dist/infra/migrations/1700713871511-UsePgVectors.js:19:9) immich-server-1 | at async MigrationExecutor.executePendingMigrations (/usr/src/app/node_modules/typeorm/migration/MigrationExecutor.js:225:17) immich-server-1 | at async DataSource.runMigrations (/usr/src/app/node_modules/typeorm/data-source/DataSource.js:260:35) immich-server-1 | at async DataSource.initialize (/usr/src/app/node_modules/typeorm/data-source/DataSource.js:148:17) immich-server-1 | [Nest] 7 - 12/17/2023, 10:43:34 AM ERROR [TypeOrmModule] Unable to connect to the database. Retrying (2)... immich-server-1 | [Nest] 7 - 12/17/2023, 10:43:34 AM LOG [InstanceLoader] BullModule dependencies initialized immich-server-1 | [Nest] 7 - 12/17/2023, 10:43:34 AM LOG [InstanceLoader] TypeOrmCoreModule dependencies initialized immich-server-1 | [Nest] 7 - 12/17/2023, 10:43:34 AM LOG [InstanceLoader] TypeOrmModule dependencies initialized immich-server-1 | [Nest] 7 - 12/17/2023, 10:43:34 AM LOG [InstanceLoader] TypeOrmModule dependencies initialized immich-server-1 | QueryFailedError: column "clipEmbedding" does not exist immich-server-1 | at PostgresQueryRunner.query (/usr/src/app/node_modules/typeorm/driver/postgres/PostgresQueryRunner.js:211:19) immich-server-1 | at process.processTicksAndRejections (node:internal/process/task_queues:95:5) immich-server-1 | at async UsePgVectors1700713871511.up (/usr/src/app/dist/infra/migrations/1700713871511-UsePgVectors.js:13:30) immich-server-1 | at async MigrationExecutor.executePendingMigrations (/usr/src/app/node_modules/typeorm/migration/MigrationExecutor.js:225:17) immich-server-1 | at async DataSource.runMigrations (/usr/src/app/node_modules/typeorm/data-source/DataSource.js:260:35) immich-server-1 | at async DataSource.initialize (/usr/src/app/node_modules/typeorm/data-source/DataSource.js:148:17) immich-server-1 | [Nest] 7 - 12/17/2023, 10:43:34 AM LOG [InstanceLoader] InfraModule dependencies initialized ``` I am now wondering if my database schema is broken: * The `smart_info` table has no column named `clipEmbedding`. * The `asset_faces`'s `CREATE` script is reported as by DbGate (my database query tool of choice): ```sql CREATE TABLE "public"."asset_faces" ( "assetId" UUID NOT NULL, "personId" UUID NULL, "embedding" USER-DEFINED NOT NULL, ... ```
Author
Owner

@tommyalatalo commented on GitHub (Dec 17, 2023):

I'm also having issues with postgres when going from 1.90.0 to 1.91.2. I first mistakenly ran the latest pgvecto-rs image with the pg14-v0.1.13 tag, then switched to pg14-v0.1.11 according to the release notes.

I'm running immich on a logical database on a postgres instance that's shared with other services.
It seems like immich is calling a function that doesn't exist.

Output from postgres:

2023-12-17 12:00:55.304 CET [311] ERROR:  could not find function "typmod_in_wrapper" in file "/usr/lib/postgresql/14/lib/vectors.so"
2023-12-17 12:00:55.304 CET [311] STATEMENT:  
	        ALTER TABLE asset_faces 
	        ALTER COLUMN embedding SET NOT NULL,
	        ALTER COLUMN embedding TYPE vector(512)

Output from microservices container:

[Nest] 7  - 12/17/2023, 11:59:57 AM   ERROR [ExceptionHandler] could not find function "typmod_in_wrapper" in file "/usr/lib/postgresql/14/lib/vectors.so"
QueryFailedError: could not find function "typmod_in_wrapper" in file "/usr/lib/postgresql/14/lib/vectors.so"
    at PostgresQueryRunner.query (/usr/src/app/node_modules/typeorm/driver/postgres/PostgresQueryRunner.js:211:19)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async UsePgVectors1700713871511.up (/usr/src/app/dist/infra/migrations/1700713871511-UsePgVectors.js:20:9)
    at async MigrationExecutor.executePendingMigrations (/usr/src/app/node_modules/typeorm/migration/MigrationExecutor.js:225:17)
    at async DataSource.runMigrations (/usr/src/app/node_modules/typeorm/data-source/DataSource.js:260:35)
    at async DataSource.initialize (/usr/src/app/node_modules/typeorm/data-source/DataSource.js:148:17)
@tommyalatalo commented on GitHub (Dec 17, 2023): I'm also having issues with postgres when going from 1.90.0 to 1.91.2. I first mistakenly ran the latest pgvecto-rs image with the `pg14-v0.1.13` tag, then switched to `pg14-v0.1.11` according to the release notes. I'm running immich on a logical database on a postgres instance that's shared with other services. It seems like immich is calling a function that doesn't exist. Output from postgres: ``` 2023-12-17 12:00:55.304 CET [311] ERROR: could not find function "typmod_in_wrapper" in file "/usr/lib/postgresql/14/lib/vectors.so" 2023-12-17 12:00:55.304 CET [311] STATEMENT: ALTER TABLE asset_faces ALTER COLUMN embedding SET NOT NULL, ALTER COLUMN embedding TYPE vector(512) ``` Output from microservices container: ``` [Nest] 7 - 12/17/2023, 11:59:57 AM ERROR [ExceptionHandler] could not find function "typmod_in_wrapper" in file "/usr/lib/postgresql/14/lib/vectors.so" QueryFailedError: could not find function "typmod_in_wrapper" in file "/usr/lib/postgresql/14/lib/vectors.so" at PostgresQueryRunner.query (/usr/src/app/node_modules/typeorm/driver/postgres/PostgresQueryRunner.js:211:19) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async UsePgVectors1700713871511.up (/usr/src/app/dist/infra/migrations/1700713871511-UsePgVectors.js:20:9) at async MigrationExecutor.executePendingMigrations (/usr/src/app/node_modules/typeorm/migration/MigrationExecutor.js:225:17) at async DataSource.runMigrations (/usr/src/app/node_modules/typeorm/data-source/DataSource.js:260:35) at async DataSource.initialize (/usr/src/app/node_modules/typeorm/data-source/DataSource.js:148:17) ```
Author
Owner

@lukaarma commented on GitHub (Dec 17, 2023):

While replacing my PostgreSQL image with the new tensorchord/pgvecto-rs:pg14 I also used the latest version and not the v0.1.11

I was encountering errors similar to those in this issue, but I was able to recover by simply loading the correct tensorchord/pgvecto-rs:pg14-v0.1.11 docker image, then logging into the Immich PostgreSQL database and running the commands DROP EXTENSION vectors; followed by CREATE EXTENSION vectors;. That fixed any errors and Immich was able to correctly load.
My guess is that the latest version of pgvecto-rs loaded some kind of metadata or something similar that was still present when trying to load the correct version of the extension and was causing some conflict, unloading and loading the extension again in the database fixed that.
Be careful to have a backup of your database as my fix is from empirical knowledge and I'm not quite sure what really was happening.
Hope this can help someone else :)

@lukaarma commented on GitHub (Dec 17, 2023): While replacing my PostgreSQL image with the new `tensorchord/pgvecto-rs:pg14` I also used the latest version and not the `v0.1.11` I was encountering errors similar to those in this issue, but I was able to recover by simply loading the correct `tensorchord/pgvecto-rs:pg14-v0.1.11` docker image, then logging into the Immich PostgreSQL database and running the commands `DROP EXTENSION vectors;` followed by `CREATE EXTENSION vectors;`. That fixed any errors and Immich was able to correctly load. My guess is that the latest version of pgvecto-rs loaded some kind of metadata or something similar that was still present when trying to load the correct version of the extension and was causing some conflict, unloading and loading the extension again in the database fixed that. **Be careful to have a backup of your database** as my fix is from empirical knowledge and I'm not quite sure what really was happening. Hope this can help someone else :)
Author
Owner

@tommyalatalo commented on GitHub (Dec 17, 2023):

While replacing my PostgreSQL image with the new tensorchord/pgvecto-rs:pg14 I also used the latest version and not the v0.1.11

I was encountering errors similar to those in this issue, but I was able to recover by simply loading the correct tensorchord/pgvecto-rs:pg14-v0.1.11 docker image, then logging into the Immich PostgreSQL database and running the commands DROP EXTENSION vectors; followed by CREATE EXTENSION vectors;. That fixed any errors and Immich was able to correctly load. My guess is that the latest version of pgvecto-rs loaded some kind of metadata or something similar that was still present when trying to load the correct version of the extension and was causing some conflict, unloading and loading the extension again in the database fixed that. Be careful to have a backup of your database as my fix is from empirical knowledge and I'm not quite sure what really was happening. Hope this can help someone else :)

I can verify that this worked for my error as well.

@tommyalatalo commented on GitHub (Dec 17, 2023): > While replacing my PostgreSQL image with the new `tensorchord/pgvecto-rs:pg14` I also used the latest version and not the `v0.1.11` > > I was encountering errors similar to those in this issue, but I was able to recover by simply loading the correct `tensorchord/pgvecto-rs:pg14-v0.1.11` docker image, then logging into the Immich PostgreSQL database and running the commands `DROP EXTENSION vectors;` followed by `CREATE EXTENSION vectors;`. That fixed any errors and Immich was able to correctly load. My guess is that the latest version of pgvecto-rs loaded some kind of metadata or something similar that was still present when trying to load the correct version of the extension and was causing some conflict, unloading and loading the extension again in the database fixed that. **Be careful to have a backup of your database** as my fix is from empirical knowledge and I'm not quite sure what really was happening. Hope this can help someone else :) I can verify that this worked for my error as well.
Author
Owner

@addd45 commented on GitHub (Dec 18, 2023):

While replacing my PostgreSQL image with the new tensorchord/pgvecto-rs:pg14 I also used the latest version and not the v0.1.11

I was encountering errors similar to those in this issue, but I was able to recover by simply loading the correct tensorchord/pgvecto-rs:pg14-v0.1.11 docker image, then logging into the Immich PostgreSQL database and running the commands DROP EXTENSION vectors; followed by CREATE EXTENSION vectors;. That fixed any errors and Immich was able to correctly load. My guess is that the latest version of pgvecto-rs loaded some kind of metadata or something similar that was still present when trying to load the correct version of the extension and was causing some conflict, unloading and loading the extension again in the database fixed that. Be careful to have a backup of your database as my fix is from empirical knowledge and I'm not quite sure what really was happening. Hope this can help someone else :)

ugh you are a life saver. I was dealing with this mess all day including installing and setting up an entire new postgres server. I will try to add my struggles to hopefully help add any more insight.

First, I have Postgres running directly on my Ubuntu server - no docker images, and not using the docker image from immich. I was running Postgres version 13 which I suppose is not compatible with the Vectors Extension. So I migrated everything from PG13 to PG16.

I started by simply installing the latest release from PGVecto, assuming the latest stable would be the best option. Thats when I started getting the same issues exactly as described here.

I uninstalled the latest release and installed the 1.11 version for pg16 , reinstalled the extension and restarted my postgres server, and still no luck. Now I was getting the "typmod" error thats described here and in the linked Issue. So I felt like at this point I was SOL - I didn't have any DB backups to start fresh from, and I didn't want to lose everything of course. but low and behold by running DROP EXTENSION vectors CASCADE (I needed CASCADE specifically as there was dependencies), followed by CREATE EXTENSION vectors, and then restarting by immich docker container, and it started right up. I'm not 100% sure honestly the order of operations I did to finally get it to work, but I'm sure the 2 SQL commands were the most important.

I know I'm probably more of a niche use-case by not using the "built-in" postgres db image, but regardless I would maybe suggest more detail on this integration and more stability. From what I understand, PGVecto is still in beta as well. Or maybe a safer way to get unstuck on DB migrations. Just my 2c suggestions :)

@addd45 commented on GitHub (Dec 18, 2023): > While replacing my PostgreSQL image with the new `tensorchord/pgvecto-rs:pg14` I also used the latest version and not the `v0.1.11` > > I was encountering errors similar to those in this issue, but I was able to recover by simply loading the correct `tensorchord/pgvecto-rs:pg14-v0.1.11` docker image, then logging into the Immich PostgreSQL database and running the commands `DROP EXTENSION vectors;` followed by `CREATE EXTENSION vectors;`. That fixed any errors and Immich was able to correctly load. My guess is that the latest version of pgvecto-rs loaded some kind of metadata or something similar that was still present when trying to load the correct version of the extension and was causing some conflict, unloading and loading the extension again in the database fixed that. **Be careful to have a backup of your database** as my fix is from empirical knowledge and I'm not quite sure what really was happening. Hope this can help someone else :) ugh you are a life saver. I was dealing with this mess all day including installing and setting up an entire new postgres server. I will try to add my struggles to hopefully help add any more insight. First, I have Postgres running directly on my Ubuntu server - no docker images, and not using the docker image from immich. I was running Postgres version 13 which I suppose is not compatible with the Vectors Extension. So I migrated everything from PG13 to PG16. I started by simply installing the latest release from PGVecto, assuming the latest stable would be the best option. Thats when I started getting the same issues exactly as described [here](https://github.com/immich-app/immich/issues/5731). I uninstalled the latest release and installed the `1.11` version for pg16 , reinstalled the extension and restarted my postgres server, and still no luck. Now I was getting the "typmod" error thats described here and in the linked Issue. So I felt like at this point I was SOL - I didn't have any DB backups to start fresh from, and I didn't want to lose everything of course. but low and behold by running `DROP EXTENSION vectors CASCADE` (I needed CASCADE specifically as there was dependencies), followed by `CREATE EXTENSION vectors`, and then restarting by immich docker container, and it started right up. I'm not 100% sure honestly the order of operations I did to finally get it to work, but I'm sure the 2 SQL commands were the most important. I know I'm probably more of a niche use-case by not using the "built-in" postgres db image, but regardless I would maybe suggest more detail on this integration and more stability. From what I understand, PGVecto is still in beta as well. Or maybe a safer way to get unstuck on DB migrations. Just my 2c suggestions :)
Author
Owner

@JshKlsn commented on GitHub (Dec 18, 2023):

Took me over an hour to figure this out, but here's the solution if you're using Unraid.

  1. Stop PostgreSQL14
  2. Go to apps tab search "tensorchord/pgvecto-rs" click the button "Click Here To Get More Results From DockerHub"
  3. Install "pgvecto-rs" by tensorchord
  4. In the template field, type "tensorchord/pgvecto-rs:pg14-v0.1.11"
  5. Change the container path 1 to your PostgreSQL14 path
  6. I don't know if this makes a difference, but I changed Container Variable: PG_MAJOR from 16 to 14.
  7. Install something like Adminer and login to your Immich database
  8. run "DROP EXTENSION vectors CASCADE;" followed by "CREATE EXTENSION vectors;"

You can now shut down pgvecto-rs and start PostgreSQL14 again, and everything should be working now. Just for extra measure I restarted the whole stack. Immich now works again.

Also this isn't a bug. This is outlined in the v1.91.0 release discussion.

@JshKlsn commented on GitHub (Dec 18, 2023): Took me over an hour to figure this out, but here's the solution if you're using Unraid. 1. Stop PostgreSQL14 2. Go to apps tab search "tensorchord/pgvecto-rs" click the button "Click Here To Get More Results From DockerHub" 3. Install "pgvecto-rs" by tensorchord 4. In the template field, type "tensorchord/pgvecto-rs:pg14-v0.1.11" 5. Change the container path 1 to your PostgreSQL14 path 6. I don't know if this makes a difference, but I changed Container Variable: PG_MAJOR from 16 to 14. 7. Install something like Adminer and login to your Immich database 8. run "DROP EXTENSION vectors CASCADE;" followed by "CREATE EXTENSION vectors;" You can now shut down pgvecto-rs and start PostgreSQL14 again, and everything should be working now. Just for extra measure I restarted the whole stack. Immich now works again. Also this isn't a bug. [This is outlined in the v1.91.0 release discussion](https://github.com/immich-app/immich/discussions/5723).
Author
Owner

@Hadatko commented on GitHub (Dec 18, 2023):

image: tensorchord/pgvecto-rs:pg16-latest # postgres:16-alpine
2023-12-18 14:43:11.176 CET [131] ERROR:  operator class "cosine_ops" does not exist for access method "vectors"
2023-12-18 14:43:11.176 CET [131] STATEMENT:  
	      CREATE INDEX IF NOT EXISTS clip_index ON smart_search
	      USING vectors (embedding cosine_ops) WITH (options = $$
	      [indexing.hnsw]
	      m = 16
	      ef_construction = 300
	      $$);
@Hadatko commented on GitHub (Dec 18, 2023): image: tensorchord/pgvecto-rs:pg16-latest # postgres:16-alpine ``` 2023-12-18 14:43:11.176 CET [131] ERROR: operator class "cosine_ops" does not exist for access method "vectors" 2023-12-18 14:43:11.176 CET [131] STATEMENT: CREATE INDEX IF NOT EXISTS clip_index ON smart_search USING vectors (embedding cosine_ops) WITH (options = $$ [indexing.hnsw] m = 16 ef_construction = 300 $$); ```
Author
Owner

@zackpollard commented on GitHub (Dec 18, 2023):

image: tensorchord/pgvecto-rs:pg16-latest # postgres:16-alpine
2023-12-18 14:43:11.176 CET [131] ERROR:  operator class "cosine_ops" does not exist for access method "vectors"
2023-12-18 14:43:11.176 CET [131] STATEMENT:  
	      CREATE INDEX IF NOT EXISTS clip_index ON smart_search
	      USING vectors (embedding cosine_ops) WITH (options = $$
	      [indexing.hnsw]
	      m = 16
	      ef_construction = 300
	      $$);

This is not related to this issue. Do not use the latest tag, use the one we mention in the release notes.

@zackpollard commented on GitHub (Dec 18, 2023): > ``` > image: tensorchord/pgvecto-rs:pg16-latest # postgres:16-alpine > ``` > > ``` > 2023-12-18 14:43:11.176 CET [131] ERROR: operator class "cosine_ops" does not exist for access method "vectors" > 2023-12-18 14:43:11.176 CET [131] STATEMENT: > CREATE INDEX IF NOT EXISTS clip_index ON smart_search > USING vectors (embedding cosine_ops) WITH (options = $$ > [indexing.hnsw] > m = 16 > ef_construction = 300 > $$); > ``` This is not related to this issue. Do not use the latest tag, use the one we mention in the release notes.
Author
Owner

@MrMarble commented on GitHub (Dec 18, 2023):

image: tensorchord/pgvecto-rs:pg16-latest # postgres:16-alpine
2023-12-18 14:43:11.176 CET [131] ERROR:  operator class "cosine_ops" does not exist for access method "vectors"
2023-12-18 14:43:11.176 CET [131] STATEMENT:  
	      CREATE INDEX IF NOT EXISTS clip_index ON smart_search
	      USING vectors (embedding cosine_ops) WITH (options = $$
	      [indexing.hnsw]
	      m = 16
	      ef_construction = 300
	      $$);

You need to use version 0.1.11 of pgvectors, latest version is not supported

@MrMarble commented on GitHub (Dec 18, 2023): > image: tensorchord/pgvecto-rs:pg16-latest # postgres:16-alpine > > > ``` > 2023-12-18 14:43:11.176 CET [131] ERROR: operator class "cosine_ops" does not exist for access method "vectors" > 2023-12-18 14:43:11.176 CET [131] STATEMENT: > CREATE INDEX IF NOT EXISTS clip_index ON smart_search > USING vectors (embedding cosine_ops) WITH (options = $$ > [indexing.hnsw] > m = 16 > ef_construction = 300 > $$); > ``` You need to use version 0.1.11 of pgvectors, latest version is not supported
Author
Owner

@Hadatko commented on GitHub (Dec 18, 2023):

Thank you, fixed, but kind of not happy with this solution. I was happy with official postgresql db which was used by many apps. And than this hack to make work some specific feature :/ Anyway as far as it will work for all containers i am ok.
Good work with immich features anyway ;)

@Hadatko commented on GitHub (Dec 18, 2023): Thank you, fixed, but kind of not happy with this solution. I was happy with official postgresql db which was used by many apps. And than this hack to make work some specific feature :/ Anyway as far as it will work for all containers i am ok. Good work with immich features anyway ;)
Author
Owner

@groetg commented on GitHub (Dec 18, 2023):

Took me over an hour to figure this out, but here's the solution if you're using Unraid.

  1. Stop PostgreSQL14
  2. Go to apps tab search "tensorchord/pgvecto-rs" click the button "Click Here To Get More Results From DockerHub"
  3. Install "pgvecto-rs" by tensorchord
  4. In the template field, type "tensorchord/pgvecto-rs:pg14-v0.1.11"
  5. Change the container path 1 to your PostgreSQL14 path
  6. I don't know if this makes a difference, but I changed Container Variable: PG_MAJOR from 16 to 14.
  7. Install something like Adminer and login to your Immich database
  8. run "DROP EXTENSION vectors CASCADE;" followed by "CREATE EXTENSION vectors;"

You can now shut down pgvecto-rs and start PostgreSQL14 again, and everything should be working now. Just for extra measure I restarted the whole stack. Immich now works again.

Also this isn't a bug. This is outlined in the v1.91.0 release discussion.

Please help me?

I reproduced every step, but I can't login to Imich database through Adminer at step 7. I use exact the same login credentials wich work when I log in the postgress 15 container!

"Unable to connect to PostgreSQL server: server closed the connection unexpectedly This probably means the server terminated abnormally before or while processing the request."

@groetg commented on GitHub (Dec 18, 2023): > Took me over an hour to figure this out, but here's the solution if you're using Unraid. > > 1. Stop PostgreSQL14 > 2. Go to apps tab search "tensorchord/pgvecto-rs" click the button "Click Here To Get More Results From DockerHub" > 3. Install "pgvecto-rs" by tensorchord > 4. In the template field, type "tensorchord/pgvecto-rs:pg14-v0.1.11" > 5. Change the container path 1 to your PostgreSQL14 path > 6. I don't know if this makes a difference, but I changed Container Variable: PG_MAJOR from 16 to 14. > 7. Install something like Adminer and login to your Immich database > 8. run "DROP EXTENSION vectors CASCADE;" followed by "CREATE EXTENSION vectors;" > > You can now shut down pgvecto-rs and start PostgreSQL14 again, and everything should be working now. Just for extra measure I restarted the whole stack. Immich now works again. > > Also this isn't a bug. [This is outlined in the v1.91.0 release discussion](https://github.com/immich-app/immich/discussions/5723). Please help me? I reproduced every step, but I can't login to Imich database through Adminer at step 7. I use exact the same login credentials wich work when I log in the postgress 15 container! "Unable to connect to PostgreSQL server: server closed the connection unexpectedly This probably means the server terminated abnormally before or while processing the request."
Author
Owner

@JshKlsn commented on GitHub (Dec 18, 2023):

Please help me?

I reproduced every step, but I can't login to Imich database through Adminer at step 7. I use exact the same login credentials wich work when I log in the postgress 15 container!

"Unable to connect to PostgreSQL server: server closed the connection unexpectedly This probably means the server terminated abnormally before or while processing the request."

The only thing I can think of is that you're using PostgreSQL 15 and not 14.

@JshKlsn commented on GitHub (Dec 18, 2023): > Please help me? > > I reproduced every step, but I can't login to Imich database through Adminer at step 7. I use exact the same login credentials wich work when I log in the postgress 15 container! > > "Unable to connect to PostgreSQL server: server closed the connection unexpectedly This probably means the server terminated abnormally before or while processing the request." The only thing I can think of is that you're using PostgreSQL 15 and not 14.
Author
Owner

@groetg commented on GitHub (Dec 18, 2023):

Please help me?
I reproduced every step, but I can't login to Imich database through Adminer at step 7. I use exact the same login credentials wich work when I log in the postgress 15 container!
"Unable to connect to PostgreSQL server: server closed the connection unexpectedly This probably means the server terminated abnormally before or while processing the request."

The only thing I can think of is that you're using PostgreSQL 15 and not 14.

I have a postgres 15 database running with immich, so yes, I have used in the example a postgres 15 database. Should I downgrade first to postgres 14 (how?) Or should I install a new database on a postgres 14 docker? Can I import the old postgres 15 database?

@groetg commented on GitHub (Dec 18, 2023): > > Please help me? > > I reproduced every step, but I can't login to Imich database through Adminer at step 7. I use exact the same login credentials wich work when I log in the postgress 15 container! > > "Unable to connect to PostgreSQL server: server closed the connection unexpectedly This probably means the server terminated abnormally before or while processing the request." > > The only thing I can think of is that you're using PostgreSQL 15 and not 14. I have a postgres 15 database running with immich, so yes, I have used in the example a postgres 15 database. Should I downgrade first to postgres 14 (how?) Or should I install a new database on a postgres 14 docker? Can I import the old postgres 15 database?
Author
Owner

@Hadatko commented on GitHub (Dec 19, 2023):

I have postgresql 16 and no problem with adminer

@Hadatko commented on GitHub (Dec 19, 2023): I have postgresql 16 and no problem with adminer
Author
Owner

@VoVAllen commented on GitHub (Dec 19, 2023):

I'm the developer of pgvecto.rs. Really sorry for bringing such problems. Does rollback work now? Is there anything else I can help answer?

@VoVAllen commented on GitHub (Dec 19, 2023): I'm the developer of pgvecto.rs. Really sorry for bringing such problems. Does rollback work now? Is there anything else I can help answer?
Author
Owner

@Nevarro commented on GitHub (Dec 19, 2023):

Took me over an hour to figure this out, but here's the solution if you're using Unraid.

  1. Stop PostgreSQL14
  2. Go to apps tab search "tensorchord/pgvecto-rs" click the button "Click Here To Get More Results From DockerHub"
  3. Install "pgvecto-rs" by tensorchord
  4. In the template field, type "tensorchord/pgvecto-rs:pg14-v0.1.11"
  5. Change the container path 1 to your PostgreSQL14 path
  6. I don't know if this makes a difference, but I changed Container Variable: PG_MAJOR from 16 to 14.
  7. Install something like Adminer and login to your Immich database
  8. run "DROP EXTENSION vectors CASCADE;" followed by "CREATE EXTENSION vectors;"

You can now shut down pgvecto-rs and start PostgreSQL14 again, and everything should be working now. Just for extra measure I restarted the whole stack. Immich now works again.

Also this isn't a bug. This is outlined in the v1.91.0 release discussion.

I tried everything according to your guide. However, using pgAdmin and the Query Tool, I get

"ERROR: extension "vectors" does not exist
SQL state: 42704"

Any idea what would help here?

EDIT: I used the official Immich guide for help. In step 8 I used

DROP EXTENSION IF EXISTS vectors; CREATE EXTENSION vectors;

which worked, however, after stopping the pgvecto-rs docker and started the postgres14 docker again, I still get the same errors in Immich

ERROR [ExceptionHandler] could not access file "$libdir/vectors": No such file or directory

@Nevarro commented on GitHub (Dec 19, 2023): > Took me over an hour to figure this out, but here's the solution if you're using Unraid. > > 1. Stop PostgreSQL14 > 2. Go to apps tab search "tensorchord/pgvecto-rs" click the button "Click Here To Get More Results From DockerHub" > 3. Install "pgvecto-rs" by tensorchord > 4. In the template field, type "tensorchord/pgvecto-rs:pg14-v0.1.11" > 5. Change the container path 1 to your PostgreSQL14 path > 6. I don't know if this makes a difference, but I changed Container Variable: PG_MAJOR from 16 to 14. > 7. Install something like Adminer and login to your Immich database > 8. run "DROP EXTENSION vectors CASCADE;" followed by "CREATE EXTENSION vectors;" > > You can now shut down pgvecto-rs and start PostgreSQL14 again, and everything should be working now. Just for extra measure I restarted the whole stack. Immich now works again. > > Also this isn't a bug. [This is outlined in the v1.91.0 release discussion](https://github.com/immich-app/immich/discussions/5723). I tried everything according to your guide. However, using pgAdmin and the Query Tool, I get "ERROR: extension "vectors" does not exist SQL state: 42704" Any idea what would help here? EDIT: I used the official Immich guide for help. In step 8 I used `DROP EXTENSION IF EXISTS vectors; CREATE EXTENSION vectors;` which worked, however, after stopping the pgvecto-rs docker and started the postgres14 docker again, I still get the same errors in Immich > ERROR [ExceptionHandler] could not access file "$libdir/vectors": No such file or directory
Author
Owner

@VoVAllen commented on GitHub (Dec 19, 2023):

@Nevarro Can you try image tensorchord/pgvecto-rs:pg14-v0.1.11 instead of official postgres image?

@VoVAllen commented on GitHub (Dec 19, 2023): @Nevarro Can you try image `tensorchord/pgvecto-rs:pg14-v0.1.11` instead of official postgres image?
Author
Owner

@Nevarro commented on GitHub (Dec 19, 2023):

@Nevarro Can you try image tensorchord/pgvecto-rs:pg14-v0.1.11 instead of official postgres image?

This way, step 8 worked and Immich is working again. Thank you very much!

@Nevarro commented on GitHub (Dec 19, 2023): > @Nevarro Can you try image `tensorchord/pgvecto-rs:pg14-v0.1.11` instead of official postgres image? This way, step 8 worked and Immich is working again. Thank you very much!
Author
Owner

@tnys commented on GitHub (Dec 19, 2023):

Just to let you know 1.91.4 resolves the deadlock. Thanks for the super-fast fix!

Cheers
Tom

@tnys commented on GitHub (Dec 19, 2023): Just to let you know 1.91.4 resolves the deadlock. Thanks for the super-fast fix! Cheers Tom
Author
Owner

@alextran1502 commented on GitHub (Dec 19, 2023):

@VoVAllen thank you for your active communication style ❤️

@alextran1502 commented on GitHub (Dec 19, 2023): @VoVAllen thank you for your active communication style ❤️
Author
Owner

@webhive commented on GitHub (Jan 8, 2024):

@Nevarro Can you try image tensorchord/pgvecto-rs:pg14-v0.1.11 instead of official postgres image?

It work! Thank you!

@webhive commented on GitHub (Jan 8, 2024): > @Nevarro Can you try image `tensorchord/pgvecto-rs:pg14-v0.1.11` instead of official postgres image? It work! Thank you!
Author
Owner

@RohithPRK commented on GitHub (Feb 2, 2024):

SQL Error [42704]: ERROR: access method "hnsw" does not exist

while creating a index

@RohithPRK commented on GitHub (Feb 2, 2024): SQL Error [42704]: ERROR: access method "hnsw" does not exist while creating a index
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: immich-app/immich#1798