Limiting RAM Use

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can. :heart:

The Basics

  • Nextcloud Server version (e.g., 29.x.x):
    • 32.0.5 - installed via Snap
  • Operating system and version (e.g., Ubuntu 24.04):
    • Manjaro 26.0.2
  • Web server and version (e.g, Apache 2.4.25):
    • Server version: Apache/2.4.66 (Unix)
  • Reverse proxy and version _(e.g. nginx 1.27.2)
    • Redis server v=7.2.11
  • PHP version (e.g, 8.3):
    • PHP 8.3.29
  • Is this the first time you’ve seen this error? (Yes / No):
    • No
  • When did this problem seem to first start?
    • Always has been an issue
  • Installation method (e.g. AlO, NCP, Bare Metal/Archive, etc.)
    • Snap
  • Are you using CloudfIare, mod_security, or similar? (Yes / No)
    • no

Summary of the issue you are facing:

When syncing a lot of files I’m seeing RAM spikes that ultimately crash my server requiring a reboot. This is happening frequently as I clean up my photo backups (purging thousands of photos that are duplicates from backups).

Steps to replicate it (hint: details matter!):

  1. From NextCloud client purge a lot of files at once (I pipe through a list of files to delete, often times it’s 10-25k files, totaling 50-100 gigs

  2. Let NextCloud sync

  3. Wait - eventually a crash happens (often)

I believe it’s possible to throttle php by editing my www.conf file within the snap shell for php-fpm but I’m hitting this error when I try:

sudo nano /var/lib/snapd/snap/nextcloud/51966/config/php/php-fpm.d/www.conf
>>> /etc/sudoers: syntax error near line 139 <<<
sudo: parse error in /etc/sudoers near line 139
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin

I have identified that particular www.conf as the currently active php for my instance of NextCloud. If I’m not mistaken, all I need to do is add the following to that file something along the lines of this:

pm = dynamic
pm.max_children = 6
pm.start_servers = 2
pm.min_spare_servers = 2
pm.max_spare_servers = 4
pm.max_requests = 300

To limit the number of instances running and hopefully stop my server from repeatedly crashing.

(Side note, would be great to be able to do this from within NextCloud UI).

Hey @Joel_Madero, welcome to the Nextcloud community and thanks for supporting Nextcloud snap :handshake:

Sorry to hear you are having issues with your Nextcloud snap installation. If you’ve come this far, you’re on the right track!

In order to help you we’ll need some Information to get an Idea of your setup, so run the debugging script and post the result here.

Below are some links to how-to’s answering frequently asked questions and may help you help yourself;

nope that won’t work… you’ll not be able to change anything there…

as that is read only

pay special attention to this: Configure Nextcloud snap · nextcloud-snap/nextcloud-snap Wiki · GitHub

Should I run this right after a crash or at any time?

please be clear… run the debugging script after reboot.

you may want to truncate your logs first and wait for the next crash:

sometimes truncating the logs and waiting for the entry to reappear makes those entries more readable, since truncating the logs removes old entries and reduces overhead. Truncating your logs is preferred to deleting the logs.

issue command in host shell:

sudo truncate -s 0 /var/snap/nextcloud/current/logs/nextcloud.log