You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Immich: Temporary workaround for Openvino memory leak during OCR
#12394
If you're running Immich with hardware-accelerated machine-learning, you might be aware of a bug with the OCR operation in which it starts to eat up all available RAM in the LXC until crashing.
I've done some testing based on this comment and I've found the suggested workaround actually does work.
All you need to do is edit /opt/immich/app/machine-learning/immich_ml/gunicorn_conf.py and add the following two lines:
max_requests = 100
max_requests_jitter = 10
Then restart the machine-learning service with systemctl restart immich-ml.
I've found that with my hardware, having max_requests at 100 prevents memory usage from reaching 4GB and beyond. Your hardware may be different and so require a different number.
I decided not to add this to the scripts as it's a pretty easy manual change, and it's a temporary workaround which doesn't fix the underlying issue.
In fact, there's a good chance the bug might be fixed or nearly mitigated in the next release: This PR is showing promise. I just tested this on my own Immich LXC and while I'm not seeing a complete elimination of the memory leak, I've found that the leak is much slower; there also appears to be a reduction in CPU usage during OCR:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
If you're running Immich with hardware-accelerated machine-learning, you might be aware of a bug with the OCR operation in which it starts to eat up all available RAM in the LXC until crashing.
I've done some testing based on this comment and I've found the suggested workaround actually does work.
All you need to do is edit
/opt/immich/app/machine-learning/immich_ml/gunicorn_conf.pyand add the following two lines:Then restart the machine-learning service with
systemctl restart immich-ml.I've found that with my hardware, having
max_requestsat 100 prevents memory usage from reaching 4GB and beyond. Your hardware may be different and so require a different number.I decided not to add this to the scripts as it's a pretty easy manual change, and it's a temporary workaround which doesn't fix the underlying issue.
In fact, there's a good chance the bug might be fixed or nearly mitigated in the next release: This PR is showing promise. I just tested this on my own Immich LXC and while I'm not seeing a complete elimination of the memory leak, I've found that the leak is much slower; there also appears to be a reduction in CPU usage during OCR:

All reactions