Preview generation failing out of memory

I have used external storage plugin to connect my photo library to nextcloud. In the photo library there are several massive TIFF images (saved from photoshop with all the layer data intact).

When I run the occ command to generate previews it fails silently when it encounters one of these files:

occ preview:generate-all --path /{external storage path} -vvv

the nextcloud.log file says:

{“reqId”:“CqaidB56r4S9NdLaQb3q”,“level”:3,“time”:“2020-01-09T03:40:23+00:00”,“remoteAddr”:“”,“user”:“–”,“app”:“PHP”,“method”:“”,“url”:“–”,“message”:“Allowed memory size of 1073741824 bytes exhausted (tried to allocate 1800928444 bytes) at /usr/local/www/nextcloud/apps/camerarawpreviews/vendor/intervention/image/src/Intervention/Image/Commands/ExifCommand.php#31”,“userAgent”:“–”,“version”:“17.0.2.1”}

It is properly generating thumbnails for all images before the large tif but there doesn’t appear to be a way to get it to skip the file it fails on, so I end up only being able to generate a preview for some of my library, then nothing. I don’t have many tif files so even disabling previews for all tif images would be acceptable if that’s a thing?

I have a number of large tiffs that I’m trying to generate previews for. It almost always runs out of memory and crashes, no matter how much memory I allocate to the php process. Sometimes it works. It seems I just have to run the occ command at least a hundred times to get it to generate successfully. There MUST be a better way.

Same problem here. I gave 6GB for PHP and still failures. It looks like memory is not being freed.
PHP Fatal error: Allowed memory size of 6442450944 bytes exhausted (tried to allocate 16384 bytes) in /var/www/html/lib/private/legacy/OC_Image.php on line 498

Looks like this issue has never been resolved. A solution to this could be, saving the directories already processed in the mysql db, and checking timestamp. If the process crashes, next iteration may ask to skip the directories already processed and resume generating thumbnails.

@simarmannsingh This is a 3 year old post, much has changed since then. Have you tried using imaginary as the preview generation back-end? It’s a lot better resource wise than using php.

Note: With docker, use the Nextcloud specific fork

https://docs.nextcloud.com/server/latest/admin_manual/installation/server_tuning.html#previews