Skip to content

fix(server): remote machine learning server leaks memory fix - #31523

Closed
ffchung wants to merge 3 commits into
immich-app:mainfrom
ffchung:ffchung-patch-2
Closed

ffchung wants to merge 3 commits into
immich-app:mainfrom
ffchung:ffchung-patch-2

Conversation

@ffchung

@ffchung ffchung commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

base on issues #31488, set const on Blob and response read or cancel.

Description

Set Bold object with const.
Handle Connection cancel after error.

Fixes # (31488)

How Has This Been Tested?

Setup with remote machine learning server. and have ton of image to process.

Before update. The ram will keep going up and OOM.

After update. The ram keep more stable.

Screenshots (if appropriate)

Checklist:

  • I have carefully read CONTRIBUTING.md
  • 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/)

Please describe to which degree, if any, an LLM was used in creating this pull request.

...

base on issues immich-app#31488, set const on Blob and response read or cancel.
Connection close fix
@immich-push-o-matic

immich-push-o-matic Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Label error. Requires exactly 1 of: changelog:.*. Found: 🗄️server. A maintainer will add the required label.

@bo0tzz

bo0tzz commented Sep 14, 2026

Copy link
Copy Markdown
Member

Please fill out the PR template completely

@ffchung ffchung changed the title remote machine learning server leaks memory fix fix:(server) remote machine learning server leaks memory fix Sep 15, 2026
@ffchung ffchung changed the title fix:(server) remote machine learning server leaks memory fix fix:(server): remote machine learning server leaks memory fix Sep 15, 2026
@ffchung ffchung changed the title fix:(server): remote machine learning server leaks memory fix fix(server): remote machine learning server leaks memory fix Sep 15, 2026
@ffchung

ffchung commented Sep 15, 2026

Copy link
Copy Markdown
Contributor Author

My Code have some help but it still have memory leak.

Node.js 24.16 Memory Leak Bug. affects fetch() uploads with a Blob body.

Same versions as the table: 24.15.0 is fine, 24.16.0 and 26.x leak, and a full GC doesn't get it back.

Ref : nodejs/node#63574

immich - Memory Leak

@ffchung

ffchung commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor Author

Fix at Node.js v24.20.0.

[ddacb3ff10] - buffer: fix Blob.stream() leaking source buffer (semimikoh) nodejs/node#63577

Ref : https://github.com/nodejs/node/releases#release-v24.20.0

@ffchung

ffchung commented Sep 15, 2026

Copy link
Copy Markdown
Contributor Author

I just try update my docker node.js to v24.21.0 and it work. memory leak gone. (I test with my new code).

@meesfrensel

Copy link
Copy Markdown
Collaborator

The linked issue is fixed by updating node; can this PR be closed?

@bo0tzz

bo0tzz commented Sep 16, 2026

Copy link
Copy Markdown
Member

I thought I'd already closed this tbf

@bo0tzz bo0tzz closed this Sep 16, 2026
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.

3 participants