Memory size exhausted

Hi to all,
in the last days I found a lot of this error in my log:
Error | PHP | Allowed memory size of 536870912 bytes exhausted (tried to allocate 20480 bytes) at /var/www/html/3rdparty/doctrine/dbal/src/Driver/PDO/Result.php#119
I think the error depending from photos app that it’s very slow.

Have anyone some experience about that?

How I can try to change memory size in php.ini? and how much memory you suggest to allocate? I don’t understand the value suggested (20480 bytes): it’s not less than 536870912? It’s a value to add to 536870912?

Sorry, but I’m not an expert… I choosed nextbox because I’m not a sysadm.

würde mich auch sehr interessieren.

Bei mir gehts um Face Recognition. die aktuell gesetzen 512mb reichen nicht und ich find ums verrecken nicht die nötige config. Vermutlich gehts mit occ da stelle ich wohl zu doof an.

Für nen tipp wo ich grundsätzlich hin muss wäre ich sehr dankbar.

Habe auch eine Weile gesucht, hier ist meine Lösung – natürlich ohne Gewähr:

  1. ssh auf Nextbox.
  2. sudo -s (<- ab jetzt wird’s gefährlich, passt auf, dass ihr nix kaputt macht. :wink: )
  3. cd /usr/lib/nextbox-compose
  4. cp docker-compose.yml docker-compose_backup.yml
  5. nano docker-compose.yml
    Obacht: YAML-Format ist empfindlich, was korrekte Einrückungen und “-” angeht!
  6. Den Abschnitt environment finden und diese Zeilen ergänzen (wenn’s 1 GB sein soll, sonst entsprechend ändern; muss mW mit M aufhören):
environment:
    - PHP_MEMORY_LIMIT=1024M
    - PHP_UPLOAD_LIMIT=1024M
  1. Datei speichern (Strg+O, Strg+X).
  2. Ich glaube, danach reicht so ein Restart (kann mich nicht mehr genau erinnern):
    systemctl restart nextbox-compose

Möglicherweise ist die Einstellung nach jedem Nextbox-Upgrade wieder weg. Seit meiner Änderung kam noch keines. (BTW: Könnte mal wieder, wir hängen ganz schön hinterher!)

Top Danke !

Thank you Lothar,
thius morning I tried your solution, now I have a new logging message:

Allowed memory size of 1073741824 bytes exhausted (tried to allocate 20480 bytes)

:laughing:

I noticed that systemctl restart nextbox-compose.service is tremendously slow.
Perhaps all this is due not so much to allocable memory but to the limit of installed physical memory?

It’s never enough! :smile:
You can see usage statistics in <your server>/settings/admin/serverinfo. Don’t know your case, but I guess the memory is not an issue. Anyway, my system never came close to its limit yet. (I have the version with 8 GB, though.)
Also just guessing: Restarting the Docker containers maybe just is slow?

After setting the limit to 2048 my nextbox was unusable: why does such a high limit coincide with the physical memory (2Gb) of the system? The connection via ssh was also very slow and sometime went out of time. Now I’m back to 1024 and I try to disable one app at a time to decrease resource use and see (I hope) which one deletes warning messages in the log.
In hindsight I should have invested more in RAM…
Thank you for your suggest and your help.

You could define a swapfile to allow the system to page out the memory areas of currently inactive processes.

s=/root/swapfile
dd if=/dev/zero of=$s bs=1M count=1024
mkswap $s
swapon $s

Most likely there already is part of the memory compressed using zram so you cannot allocate more than physical ram - zram. „free“ command will show you what is free to use for processes.

After a reboot (via ssh)

> free -wh
               total        used        free      shared     buffers       cache   available
Mem:           1.8Gi       1.4Gi       249Mi        51Mi        12Mi       196Mi       344Mi
Swap:          2.0Gi       283Mi       1.7Gi

after some time spend to disable some apps

> free -hw
               total        used        free      shared     buffers       cache   available
Mem:           1.8Gi       1.6Gi        43Mi        37Mi       8.0Mi       137Mi        69Mi
Swap:          2.0Gi       1.5Gi       515Mi

now

> free -hw
               total        used        free      shared     buffers       cache   available
Mem:           1.8Gi       1.6Gi        57Mi        33Mi        15Mi       165Mi       143Mi
Swap:          2.0Gi       2.0Gi       0.0Ki

seem to be something that consuming resources or somtething that don’t release memory but I’m not so skilled to analyze that. Yes/No?

Hi,
I think your PHP memory limit is being exceeded. You can increase the memory limit by editing your php.ini file. Look for the line memory_limit and increase it, for example to memory_limit = 1024M. The 20480 bytes is the amount that caused the overflow, but the total used memory was already at the 536870912 bytes (512MB) limit. Start by doubling the limit to 1024M and monitor the performance.
Thanks

Which php.ini? Could you help me by showing me the route? I would be very grateful.