immich-app / immich

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

[BUG] Time zone displacement out of range #4538

Closed EnochPrime closed 1 year ago

EnochPrime commented 1 year ago

The bug

After updating to v1.82.0 I receive multiple errors about time zone displacement out of range.

image

Server Log

immich_server.1.n4t7f1c9uj5c@McMint    | [Nest] 8  - 10/18/2023, 11:37:19 PM   ERROR [ExceptionsHandler] time zone displacement out of range: "+095405-03-01T00:00:00.000Z"
immich_server.1.n4t7f1c9uj5c@McMint    | QueryFailedError: time zone displacement out of range: "+095405-03-01T00:00:00.000Z"
immich_server.1.n4t7f1c9uj5c@McMint    |     at PostgresQueryRunner.query (/usr/src/app/node_modules/typeorm/driver/postgres/PostgresQueryRunner.js:211:19)
immich_server.1.n4t7f1c9uj5c@McMint    |     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
immich_server.1.n4t7f1c9uj5c@McMint    |     at async SelectQueryBuilder.loadRawResults (/usr/src/app/node_modules/typeorm/query-builder/SelectQueryBuilder.js:2183:25)
immich_server.1.n4t7f1c9uj5c@McMint    |     at async SelectQueryBuilder.executeEntitiesAndRawResults (/usr/src/app/node_modules/typeorm/query-builder/SelectQueryBuilder.js:2034:26)
immich_server.1.n4t7f1c9uj5c@McMint    |     at async SelectQueryBuilder.getRawAndEntities (/usr/src/app/node_modules/typeorm/query-builder/SelectQueryBuilder.js:684:29)
immich_server.1.n4t7f1c9uj5c@McMint    |     at async SelectQueryBuilder.getMany (/usr/src/app/node_modules/typeorm/query-builder/SelectQueryBuilder.js:750:25)
immich_server.1.n4t7f1c9uj5c@McMint    |     at async AssetService.getByTimeBucket (/usr/src/app/dist/domain/asset/asset.service.js:171:24)
immich_server.1.n4t7f1c9uj5c@McMint    |     at async /usr/src/app/node_modules/@nestjs/core/router/router-execution-context.js:46:28
immich_server.1.n4t7f1c9uj5c@McMint    |     at async /usr/src/app/node_modules/@nestjs/core/router/router-proxy.js:9:17

Database Log

immich_db.1.4vtgqnbz8seq@McMint    | 2023-10-18 23:41:07.653 UTC [1457] ERROR:  time zone displacement out of range: "+040087-10-01T00:00:00.000Z"
immich_db.1.4vtgqnbz8seq@McMint    | 2023-10-18 23:41:07.653 UTC [1457] CONTEXT:  unnamed portal parameter $3 = '...'
immich_db.1.4vtgqnbz8seq@McMint    | 2023-10-18 23:41:07.653 UTC [1457] STATEMENT:  SELECT "asset"."id" AS "asset_id", "asset"."deviceAssetId" AS "asset_deviceAssetId", "asset"."ownerId" AS "asset_ownerId", "asset"."libraryId" AS "asset_libraryId", "asset"."deviceId" AS "asset_deviceId", "asset"."type" AS "asset_type", "asset"."originalPath" AS "asset_originalPath", "asset"."resizePath" AS "asset_resizePath", "asset"."webpPath" AS "asset_webpPath", "asset"."thumbhash" AS "asset_thumbhash", "asset"."encodedVideoPath" AS "asset_encodedVideoPath", "asset"."createdAt" AS "asset_createdAt", "asset"."updatedAt" AS "asset_updatedAt", "asset"."deletedAt" AS "asset_deletedAt", "asset"."fileCreatedAt" AS "asset_fileCreatedAt", "asset"."localDateTime" AS "asset_localDateTime", "asset"."fileModifiedAt" AS "asset_fileModifiedAt", "asset"."isFavorite" AS "asset_isFavorite", "asset"."isArchived" AS "asset_isArchived", "asset"."isExternal" AS "asset_isExternal", "asset"."isReadOnly" AS "asset_isReadOnly", "asset"."isOffline" AS "asset_isOffline", "asset"."checksum" AS "asset_checksum", "asset"."duration" AS "asset_duration", "asset"."isVisible" AS "asset_isVisible", "asset"."livePhotoVideoId" AS "asset_livePhotoVideoId", "asset"."originalFileName" AS "asset_originalFileName", "asset"."sidecarPath" AS "asset_sidecarPath", "exifInfo"."assetId" AS "exifInfo_assetId", "exifInfo"."description" AS "exifInfo_description", "exifInfo"."exifImageWidth" AS "exifInfo_exifImageWidth", "exifInfo"."exifImageHeight" AS "exifInfo_exifImageHeight", "exifInfo"."fileSizeInByte" AS "exifInfo_fileSizeInByte", "exifInfo"."orientation" AS "exifInfo_orientation", "exifInfo"."dateTimeOriginal" AS "exifInfo_dateTimeOriginal", "exifInfo"."modifyDate" AS "exifInfo_modifyDate", "exifInfo"."timeZone" AS "exifInfo_timeZone", "exifInfo"."latitude" AS "exifInfo_latitude", "exifInfo"."longitude" AS "exifInfo_longitude", "exifInfo"."projectionType" AS "exifInfo_projectionType", "exifInfo"."city" AS "exifInfo_city", "exifInfo"."livePhotoCID" AS "exifInfo_livePhotoCID", "exifInfo"."state" AS "exifInfo_state", "exifInfo"."country" AS "exifInfo_country", "exifInfo"."make" AS "exifInfo_make", "exifInfo"."model" AS "exifInfo_model", "exifInfo"."lensModel" AS "exifInfo_lensModel", "exifInfo"."fNumber" AS "exifInfo_fNumber", "exifInfo"."focalLength" AS "exifInfo_focalLength", "exifInfo"."iso" AS "exifInfo_iso", "exifInfo"."exposureTime" AS "exifInfo_exposureTime", "exifInfo"."profileDescription" AS "exifInfo_profileDescription", "exifInfo"."colorspace" AS "exifInfo_colorspace", "exifInfo"."bitsPerSample" AS "exifInfo_bitsPerSample", "exifInfo"."fps" AS "exifInfo_fps", "exifInfo"."exifTextSearchableColumn" AS "exifInfo_exifTextSearchableColumn" FROM "assets" "asset" LEFT JOIN "exif" "exifInfo" ON "exifInfo"."assetId"="asset"."id" WHERE ( "asset"."isVisible" = true AND "asset"."ownerId" = $1 AND "asset"."isArchived" = $2 AND (date_trunc('month', ("localDateTime" at time zone 'UTC')) at time zone 'UTC')::timestamptz = $3 ) AND ( "asset"."deletedAt" IS NULL ) ORDER BY (date_trunc('month', ("localDateTime" at time zone 'UTC')) at time zone 'UTC')::timestamptz DESC, "asset"."fileCreatedAt" DESC

The OS that Immich Server is running on

Linux Mint 21.2

Version of Immich Server

v1.82.0

Version of Immich Mobile App

v1.82.0

Platform with the issue

Your docker-compose.yml content

version: "3.9"

# swarm deployment extension
x-deploy-swarm: &deploy_swarm
  mode: replicated
  replicas: 1
  update_config:
    parallelism: 1
    delay: 10s
    order: stop-first

# immich environment
x-immich-env: &immich_environment
  NODE_ENV: production
  DB_HOSTNAME: db
  DB_DATABASE_NAME: ${IMMICH_DB:-immich}
  DB_USERNAME: ${IMMICH_DB_USERNAME:-immich}
  DB_PASSWORD: ${IMMICH_DB_PASSWORD:-immich}
  TYPESENSE_HOST: typesense
  TYPESENSE_API_KEY: ${TYPESENSE_API_KEY:?error}

services:
  app:
    image: ghcr.io/immich-app/immich-web:v1.82.0
    environment:
      IMMICH_SERVER_URL: http://server:3001
    networks:
      - frontend
    deploy:
      <<: *deploy_swarm
      resources:
        limits:
          cpus: ${IMMICH_APP_CPU_LIMIT}
          memory: ${IMMICH_APP_MEM_LIMIT}

  server:
    image: ghcr.io/immich-app/immich-server:v1.82.0
    command: start-server.sh
    environment:
      <<: *immich_environment
    volumes:
      - /media/pictures/immich:/usr/src/app/upload/library
      - ${STORAGE_PATH}/{{index .Service.Labels "com.docker.stack.namespace"}}/upload:/usr/src/app/upload/upload
      - ${STORAGE_PATH}/{{index .Service.Labels "com.docker.stack.namespace"}}/profile:/usr/src/app/upload/profile
      - ${STORAGE_PATH}/{{index .Service.Labels "com.docker.stack.namespace"}}/thumbs:/usr/src/app/upload/thumbs
      - ${STORAGE_PATH}/{{index .Service.Labels "com.docker.stack.namespace"}}/encoded-video:/usr/src/app/upload/encoded-video
      - /media/pictures:/media/pictures:ro
    networks:
      - frontend
      - database
      - machine-learning
      - redis
      - typesense
    deploy:
      <<: *deploy_swarm
      resources:
        limits:
          cpus: ${IMMICH_SERVER_CPU_LIMIT}
          memory: ${IMMICH_SERVER_MEM_LIMIT}
      restart_policy:
        delay: 120s
        max_attempts: 3
      placement:
        constraints:
          - node.hostname == McMint

  microservices:
    image: ghcr.io/immich-app/immich-server:v1.82.0
    command: start-microservices.sh
    environment:
      <<: *immich_environment
    volumes:
      - /media/pictures/immich:/usr/src/app/upload/library
      - ${STORAGE_PATH}/{{index .Service.Labels "com.docker.stack.namespace"}}/upload:/usr/src/app/upload/upload
      - ${STORAGE_PATH}/{{index .Service.Labels "com.docker.stack.namespace"}}/profile:/usr/src/app/upload/profile
      - ${STORAGE_PATH}/{{index .Service.Labels "com.docker.stack.namespace"}}/thumbs:/usr/src/app/upload/thumbs
      - ${STORAGE_PATH}/{{index .Service.Labels "com.docker.stack.namespace"}}/encoded-video:/usr/src/app/upload/encoded-video
      - /media/pictures:/media/pictures:ro
    networks:
      - database
      - machine-learning
      - redis
      - typesense
    deploy:
      <<: *deploy_swarm
      resources:
        limits:
          cpus: ${IMMICH_MICROSERVICES_CPU_LIMIT}
          memory: ${IMMICH_MICROSERVICES_MEM_LIMIT}
      restart_policy:
        delay: 120s
        max_attempts: 3
      placement:
        constraints:
          - node.hostname == McMint

  machine-learning:
    image: ghcr.io/immich-app/immich-machine-learning:v1.82.0
    volumes:
      - ${STORAGE_PATH}/immich/ml-cache:/cache
    networks:
      - machine-learning
    deploy:
      <<: *deploy_swarm
      placement:
        constraints:
          - node.platform.arch == x86_64
      resources:
        limits:
          cpus: ${IMMICH_ML_CPU_LIMIT}
          memory: ${IMMICH_ML_MEM_LIMIT}

  db:
    image: postgres:14.8
    environment:
      POSTGRES_DB: ${IMMICH_DB:-immich}
      POSTGRES_USER: ${IMMICH_DB_USERNAME:-immich}
      POSTGRES_PASSWORD: ${IMMICH_DB_PASSWORD:-immich}
    volumes:
      - ${STORAGE_PATH}/{{index .Service.Labels "com.docker.stack.namespace"}}/db:/var/lib/postgresql/data
    networks:
      - database
    deploy:
      <<: *deploy_swarm
      resources:
        limits:
          cpus: ${IMMICH_DB_CPU_LIMIT}
          memory: ${IMMICH_DB_MEM_LIMIT}

  redis:
    image: redis:6.2.13
    networks:
      - redis
    deploy:
      <<: *deploy_swarm
      resources:
        limits:
          cpus: '0.1'
          memory: 32M

  typesense:
    image: typesense/typesense:0.24.1
    environment:
      TYPESENSE_API_KEY: ${TYPESENSE_API_KEY:?error}
      TYPESENSE_DATA_DIR: /data
    volumes:
      - ${STORAGE_PATH}/{{index .Service.Labels "com.docker.stack.namespace"}}/typesense:/data
    networks:
      - typesense
    deploy:
      <<: *deploy_swarm
      placement:
        constraints:
          - node.platform.arch == x86_64

networks:
  frontend:
    external: true
    name: core_frontend
  database:
    driver: overlay
  machine-learning:
    driver: overlay
  redis:
    driver: overlay
  typesense:
    driver: overlay

Your .env content

IMMICH_APP_CPU_LIMIT = '0.3'
IMMICH_APP_MEM_LIMIT = '128M'

IMMICH_DB_CPU_LIMIT = '0.3'
IMMICH_DB_MEM_LIMIT = '256M'

IMMICH_SERVER_CPU_LIMIT = '1.0'
IMMICH_SERVER_MEM_LIMIT = '256M'

IMMICH_MICROSERVICES_CPU_LIMIT = '4.0'
IMMICH_MICROSERVICES_MEM_LIMIT = '2.0G'

IMMICH_ML_CPU_LIMIT = '4.0'
IMMICH_ML_MEM_LIMIT = '3.0G'

Reproduction steps

1. Open Immich web

Additional information

No response

alextran1502 commented 1 year ago

This is the error due to bad data from EXIF. Currently, the workaround is to use the mobile app to log into the instance and remove the files that are in the bad year, usually that are years in the future

alextran1502 commented 1 year ago

Fixed in #4540