Nextcloud crashes my server when generating previews

Hi everyone!
I installed Nextcloud about a week ago on a DigitalOcean droplet. I am having an issue with image previews - every time there is generation of previews, it starts ok but after a while it increases the server load exponentially to the point where the server becomes unresponsive.

My set up is as follows:

VPS spec: 2 vCPUs, 4GB RAM
Nextcloud version: 18.0.4 (snap)
Operating system and version: Ubuntu 18.04.3

I have a particular setup with my data folder - I use rclone encrypted remotes pointed at Google Drive, and the Nextcloud data folder is on /media/GDrive which is a folder on that rclone encrypted remote.
I use this setup for other things as well (e.g. Plex) and it works well, albeit with increased access times sometimes.
The photos are in another mount added as ‘external storage’ to Nextcloud. I have also tried generating previews for photos stored in my Nextcloud folders (not in ‘external storage’), same result.

I have tried generating previews both using the Preview Generator and on-demand (e.g. opening each folder one at a time), the problem occurs regardless.

If I disable previews in config.php, then the problem goes away, I can view pictures normally.

The Admin -> Logging area just shows some logs from 6 days ago, nothing recent or related to the crashes.
I am not sure which other logs to paste here, as I use the snap version and I understand it handles apache and php by itself within the snap, and don’t want to be pasting unnecessary ones - if someone can point out the correct one to paste, I’ll be more than happy to.

If no one else is having this issue, I am guessing it must be related to my rclone setup, however if anyone has any insights or seen this before, I would certainly appreciate your input.

The output of

occ preview:pre-generate -vvv

@JimmyKater could you move that thread to the preview generator section please?

1 Like

I’m seeing something similar.

Nextcloud 19 on openSUSE Leap 15.1

Installed via a repo. No special mounts.

Every time I try to Pre-generate the thumbnails, CPU spikes to at or near 100% and ram slowly increases until the system freezes. From watching the resource monitor it seems to be worse when processing a folder with lots of images.

Weirdly I decided to run the preview generator again yesterday. It ran fine until this afternoon, and then it gave me this error and exited:

2020-06-05T16:18:32+00:00 OCA\PreviewGenerator\Command\Generate->execute() at /snap/nextcloud/21026/htdocs/3rdparty/symfony/console/Command/Command.php:255
2020-06-05T16:18:32+00:00 Symfony\Component\Console\Command\Command->run() at /snap/nextcloud/21026/htdocs/3rdparty/symfony/console/Application.php:915
2020-06-05T16:18:32+00:00 Symfony\Component\Console\Application->doRunCommand() at /snap/nextcloud/21026/htdocs/3rdparty/symfony/console/Application.php:272
2020-06-05T16:18:32+00:00 Symfony\Component\Console\Application->doRun() at /snap/nextcloud/21026/htdocs/3rdparty/symfony/console/Application.php:148
2020-06-05T16:18:32+00:00 Symfony\Component\Console\Application->run() at /snap/nextcloud/21026/htdocs/lib/private/Console/Application.php:214
2020-06-05T16:18:32+00:00 OC\Console\Application->run() at /snap/nextcloud/21026/htdocs/console.php:99
2020-06-05T16:18:32+00:00 require_once() at /snap/nextcloud/21026/htdocs/occ:11
2020-06-05T16:18:32+00:00
2020-06-05T16:18:32+00:00 preview:generate-all [-p|–path [PATH]] [–] [<user_id>]
2020-06-05T16:18:32+00:00

Running it again didn’t work until I restarted the Nextcloud snap. Then it started scanning the folders, and now it is stuck at ‘scanning’ the same folder where it was generating previews when the crash happened.
Does the error log above indicate anything useful, like if it’s a bad photo in that folder? I’ve checked and all previews in that folder have been generated, and all photos can be viewed without problems.

Also, the real bad crashes happened when previews were being generated by Nextcloud when I opened a new folder that didn’t have previews made before. Is there a way to log those (if there is I will try again so we can generate something to help investigate)?