nextcloud / nextcloud/recognize

Allowed memory size of<> bytes exhausted (MrdBallTree.php#450)

Open
#1,268 22 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug priority: normal waiting for more information
Dominant language
PHP
Stars
699
Forks
68
Avg merge
1d 4h
Merged PRs (30d)
5

Description

Which version of recognize are you using?

8.2.0

Enabled Modes

Face recognition

TensorFlow mode

Normal mode

Downstream App

Memories App

Which Nextcloud version do you have installed?

30.0.4

Which Operating system do you have installed?

Linux 4.18.0-513.5.1.el8_9.x86_64 x86_64

Which database are you running Nextcloud on?

mysql/MariaDB 10.3.39

Which Docker container are you using to run Nextcloud? (if applicable)

No response

How much RAM does your server have?

7.5GB

What processor Architecture does your CPU have?

AMD EPYC Processor (with IBPB) (4 threads)

Describe the Bug

Error in log file (I always get them two at the time). At night I receive them (probably the cron job) and also when uploading (multiple) images.

[PHP] Fout: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 655360 bytes) at /var/www/cloud.DOMAIN.TLD/html/apps/recognize/lib/Clustering/MrdBallTree.php#450
	from ? by -- at 2 apr 2025, 20:49:43

I have these errors for a long time.

My PHP info:

Version: 8.2.12
Memory limit: 1 GB
Max time: 3600
Max. upload size: 1 GB
Frequentie OPcache validation: 2

Extensions: Core, date, libxml, openssl, pcre, zlib, filter, hash, json, random, Reflection, SPL, session, standard, cgi-fcgi, bcmath, bz2, calendar, ctype, curl, dom, mbstring, fileinfo, ftp, gd, gettext, gmp, iconv, intl, exif, mysqlnd, PDO, Phar, posix, shmop, SimpleXML, sockets, sodium, sqlite3, sysvmsg, sysvsem, sysvshm, tokenizer, xml, xmlwriter, xsl, mysqli, pdo_mysql, pdo_sqlite, xmlreader, zip, apcu, igbinary, imagick, msgpack, redis, Zend OPcache

Extra info, probably not relates:

Image

Also after manually downloading the models, this status keeps returning

Expected Behavior

I don't expect an error. I have no clue if this means the image is not analysed

To Reproduce
  1. Uploading images (I think it's always with multiple images)
  2. cron job at night
Debug log

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at apps/recognize/lib/Clustering/MrdBallTree.php around line 450 and reproduce the failure during multi-image uploads and the nighttime cron job. Check how the face-recognition clustering path uses memory under the reported 1 GB PHP limit. Done means the reported processing completes without the memory exhaustion error and its behavior is verified for both triggers.

Written by the indexing model from the issue text.

Assessment

Tech stack
machine-learning, php
Domain
backend, machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.