[BUG] Server errors about image deduplication and user constraint #421

Closed
opened 2026-02-04 20:25:01 +03:00 by OVERLORD · 2 comments
Owner

Originally created by @klejejs on GitHub (Nov 15, 2022).

Describe the bug
(Sorry for the chaotic title, I was not sure how to formulate it)
Every time the whole stack is restarted, I get the same few hundred lines of errors.
In microservices:

[Nest] 7  - 11/15/2022, 5:12:02 PM   ERROR upload/6b5053f6-053c-4f83-90de-2b04f741031c/original/2efd84ac9d604df68b84523205dcf8dc/efbf0c20-84ae-41b4-bd44-9e5e8d2bd0ef.jpg duplicated
[Nest] 7  - 11/15/2022, 5:12:02 PM   ERROR upload/6b5053f6-053c-4f83-90de-2b04f741031c/original/CLI/91b8f210-4c33-4d38-8285-0d76451ee09f.jpg duplicated
[Nest] 7  - 11/15/2022, 5:12:02 PM   ERROR upload/6b5053f6-053c-4f83-90de-2b04f741031c/original/CLI/c05a6743-8233-4aa3-b4bb-9b684de5492d.jpg duplicated
[Nest] 7  - 11/15/2022, 5:12:02 PM   ERROR upload/6b5053f6-053c-4f83-90de-2b04f741031c/original/2efd84ac9d604df68b84523205dcf8dc/d5d1e100-0629-457c-b6a9-ab42daa98147.jpg duplicated
[Nest] 7  - 11/15/2022, 5:12:02 PM   ERROR upload/6b5053f6-053c-4f83-90de-2b04f741031c/original/2efd84ac9d604df68b84523205dcf8dc/729e53a8-e87c-426c-baad-c2448017a246.jpg duplicated

In Postgres:

2022-11-15 17:12:02.678 UTC [36] DETAIL:  Key ("userId", checksum)=(6b5053f6-053c-4f83-90de-2b04f741031c, \xc3bb20e0f9b39d753458edb676dcaef40de885f1) already exists.
2022-11-15 17:12:02.678 UTC [36] STATEMENT:  UPDATE "assets" SET "checksum" = $1 WHERE "id" IN ($2)
2022-11-15 17:12:02.763 UTC [36] ERROR:  duplicate key value violates unique constraint "UQ_userid_checksum"
2022-11-15 17:12:02.763 UTC [36] DETAIL:  Key ("userId", checksum)=(6b5053f6-053c-4f83-90de-2b04f741031c, \x133dfc0a9757c0efec6ea9e1cd6b10fad359cdf4) already exists.
2022-11-15 17:12:02.763 UTC [36] STATEMENT:  UPDATE "assets" SET "checksum" = $1 WHERE "id" IN ($2)
2022-11-15 17:12:02.876 UTC [36] ERROR:  duplicate key value violates unique constraint "UQ_userid_checksum"
2022-11-15 17:12:02.876 UTC [36] DETAIL:  Key ("userId", checksum)=(6b5053f6-053c-4f83-90de-2b04f741031c, \xb4eaf06d2e5fd2026f56fe4ec7456869b16d2a2f) already exists.
2022-11-15 17:12:02.876 UTC [36] STATEMENT:  UPDATE "assets" SET "checksum" = $1 WHERE "id" IN ($2)

I read about deduplication, but if this is related to that, shouldn't the errors appear only the first time? Also UQ_userid_checksum seems suspicious. For context, I have 2 users - admin user and another user.

I have also noticed that every time when I go to the administration page, the server part of the stack stops responding and it takes either ~30 minutes or a server (only) restart for it to be responding again.

Task List

  • I have read thoroughly the README setup and installation instructions.
  • I have included my docker-compose file.
  • I have included my redacted .env file.
  • I have included information on my machine, and environment.

System

  • Server Version: v1.35.0

Additional context
These issues appeared after a large number of photos were uploaded which caused the server to be low on memory. Could that be related?

Please let me know if any additional information is required.

Originally created by @klejejs on GitHub (Nov 15, 2022). **Describe the bug** (Sorry for the chaotic title, I was not sure how to formulate it) Every time the whole stack is restarted, I get the same few hundred lines of errors. In microservices: ``` [Nest] 7 - 11/15/2022, 5:12:02 PM ERROR upload/6b5053f6-053c-4f83-90de-2b04f741031c/original/2efd84ac9d604df68b84523205dcf8dc/efbf0c20-84ae-41b4-bd44-9e5e8d2bd0ef.jpg duplicated [Nest] 7 - 11/15/2022, 5:12:02 PM ERROR upload/6b5053f6-053c-4f83-90de-2b04f741031c/original/CLI/91b8f210-4c33-4d38-8285-0d76451ee09f.jpg duplicated [Nest] 7 - 11/15/2022, 5:12:02 PM ERROR upload/6b5053f6-053c-4f83-90de-2b04f741031c/original/CLI/c05a6743-8233-4aa3-b4bb-9b684de5492d.jpg duplicated [Nest] 7 - 11/15/2022, 5:12:02 PM ERROR upload/6b5053f6-053c-4f83-90de-2b04f741031c/original/2efd84ac9d604df68b84523205dcf8dc/d5d1e100-0629-457c-b6a9-ab42daa98147.jpg duplicated [Nest] 7 - 11/15/2022, 5:12:02 PM ERROR upload/6b5053f6-053c-4f83-90de-2b04f741031c/original/2efd84ac9d604df68b84523205dcf8dc/729e53a8-e87c-426c-baad-c2448017a246.jpg duplicated ``` In Postgres: ``` 2022-11-15 17:12:02.678 UTC [36] DETAIL: Key ("userId", checksum)=(6b5053f6-053c-4f83-90de-2b04f741031c, \xc3bb20e0f9b39d753458edb676dcaef40de885f1) already exists. 2022-11-15 17:12:02.678 UTC [36] STATEMENT: UPDATE "assets" SET "checksum" = $1 WHERE "id" IN ($2) 2022-11-15 17:12:02.763 UTC [36] ERROR: duplicate key value violates unique constraint "UQ_userid_checksum" 2022-11-15 17:12:02.763 UTC [36] DETAIL: Key ("userId", checksum)=(6b5053f6-053c-4f83-90de-2b04f741031c, \x133dfc0a9757c0efec6ea9e1cd6b10fad359cdf4) already exists. 2022-11-15 17:12:02.763 UTC [36] STATEMENT: UPDATE "assets" SET "checksum" = $1 WHERE "id" IN ($2) 2022-11-15 17:12:02.876 UTC [36] ERROR: duplicate key value violates unique constraint "UQ_userid_checksum" 2022-11-15 17:12:02.876 UTC [36] DETAIL: Key ("userId", checksum)=(6b5053f6-053c-4f83-90de-2b04f741031c, \xb4eaf06d2e5fd2026f56fe4ec7456869b16d2a2f) already exists. 2022-11-15 17:12:02.876 UTC [36] STATEMENT: UPDATE "assets" SET "checksum" = $1 WHERE "id" IN ($2) ``` I read about deduplication, but if this is related to that, shouldn't the errors appear only the first time? Also `UQ_userid_checksum` seems suspicious. For context, I have 2 users - admin user and another user. I have also noticed that every time when I go to the administration page, the server part of the stack stops responding and it takes either ~30 minutes or a server (only) restart for it to be responding again. **Task List** - [x] I have read thoroughly the README setup and installation instructions. - [ ] I have included my `docker-compose` file. - [ ] I have included my redacted `.env` file. - [ ] I have included information on my machine, and environment. **System** - Server Version: `v1.35.0` **Additional context** These issues appeared after a large number of photos were uploaded which caused the server to be low on memory. Could that be related? Please let me know if any additional information is required.
Author
Owner

@alextran1502 commented on GitHub (Nov 15, 2022):

These messages are from your previous duplicated assets you uploaded before the dedup mechanism was put in. You can safely ignore them.

There is a known issue on the server stats that counts the files and causes problems with a system with many, many assets. You are welcomed and encouraged to open an issue for this.

@alextran1502 commented on GitHub (Nov 15, 2022): These messages are from your previous duplicated assets you uploaded before the dedup mechanism was put in. You can safely ignore them. There is a known issue on the server stats that counts the files and causes problems with a system with many, many assets. You are welcomed and encouraged to open an issue for this.
Author
Owner

@klejejs commented on GitHub (Nov 15, 2022):

Thank you for the quick reply! Created #976.

@klejejs commented on GitHub (Nov 15, 2022): Thank you for the quick reply! Created #976.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: immich-app/immich#421