Skip to content

fix: MAX_PARAMETERS_EXCEEDED error during person cleanup job #17222

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Mar 31, 2025

Conversation

hwang3419
Copy link
Contributor

Description

Fix MAX_PARAMETERS_EXCEEDED error while running person cleanup job

When deleting a large list of people id, the cleanup job would fail
error logs looks like this:

2025-03-29 09:52:26 immich_server | '0035574c-d90a-4a26-a59d-3048a12e0ce5',
2025-03-29 09:52:26 immich_server | '0035fe2c-1f2b-4e69-b434-471d6f90c131',
2025-03-29 09:52:26 immich_server | '00363762-0202-4700-a8da-01b30e5b96e3',
2025-03-29 09:52:26 immich_server | '00366197-c46e-4d0e-bb0d-9db38f969f26',
2025-03-29 09:52:26 immich_server | ... 107324 more items
2025-03-29 09:52:26 immich_server | ]
2025-03-29 09:52:26 immich_server | }
2025-03-29 09:52:26 immich_server | [Nest] 7 - 03/29/2025, 2:52:26 PM WARN [Microservices:StorageRepository] File upload/thumbs/17b74790-7821-4f2f-977e-5256626dc7c4/ff/fe/fffe2196-63d9-42c7-b0c4-d008fbd99146.jpeg does not exist.
2025-03-29 09:52:26 immich_server | [Nest] 7 - 03/29/2025, 2:52:26 PM ERROR [Microservices:{}] Unable to run job handler (backgroundTask/person-cleanup): Error: MAX_PARAMETERS_EXCEEDED: Max number of parameters (65534) exceeded

Fixes # (issue)

How Has This Been Tested?

  • Test A I tested the job in the dev instance with a few deletion, but I was not able to create a a huge list similar to my own instance
  • Test B

Screenshots (if appropriate)

Checklist:

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation if applicable
  • I have no unrelated changes in the PR.
  • I have confirmed that any new dependencies are strictly necessary.
  • I have written tests for new code (if applicable)
  • I have followed naming conventions/patterns in the surrounding code
  • All code in src/services/ uses repositories implementations for database calls, filesystem operations, etc.
  • All code in src/repositories/ is pretty basic/simple and does not have any immich specific logic (that belongs in src/services/)

hwang3419 and others added 2 commits March 2, 2025 17:18
…rvices:{}] Unable to run job handler (backgroundTask/person-cleanup): Error: MAX_PARAMETERS_EXCEEDED: Max number of parameters (65534) exceeded
@danieldietzler danieldietzler requested a review from mertalev March 30, 2025 11:07
@mertalev
Copy link
Contributor

mertalev commented Mar 30, 2025

There's a @Chunked decorator for repository methods that does this automatically. You should add that to the delete method instead.

@hwang3419
Copy link
Contributor Author

There's a @Chunked decorator for repository methods that does this automatically. You should add that to the delete method instead.

Ok, let me take a look

@zackpollard zackpollard changed the title Fix MAX_PARAMETERS_EXCEEDED error while running person cleanup job fix: MAX_PARAMETERS_EXCEEDED error during person cleanup job Mar 31, 2025
@zackpollard zackpollard enabled auto-merge (squash) March 31, 2025 11:30
@zackpollard zackpollard merged commit a831876 into immich-app:main Mar 31, 2025
40 checks passed
kirill-dev-pro pushed a commit to kirill-dev-pro/immich-but-with-public-albums-within-instance that referenced this pull request Apr 6, 2025
…app#17222)

* add batch size in sql delete,fix person cleanup error: ERROR [Microservices:{}] Unable to run job handler (backgroundTask/person-cleanup): Error: MAX_PARAMETERS_EXCEEDED: Max number of parameters (65534) exceeded

* add chunked decorator to delete

* chore: prettier formatting fixes

---------

Co-authored-by: hwang3419 <“[email protected]”>
Co-authored-by: Zack Pollard <[email protected]>
savely-krasovsky pushed a commit to savely-krasovsky/immich that referenced this pull request Jun 8, 2025
…app#17222)

* add batch size in sql delete,fix person cleanup error: ERROR [Microservices:{}] Unable to run job handler (backgroundTask/person-cleanup): Error: MAX_PARAMETERS_EXCEEDED: Max number of parameters (65534) exceeded

* add chunked decorator to delete

* chore: prettier formatting fixes

---------

Co-authored-by: hwang3419 <“[email protected]”>
Co-authored-by: Zack Pollard <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants