PHP7.0-FPM CPU usage at 100% when photo folder is accessed

Nextcloud version : 14.0.3
Operating system and version: Debian 9.5
Apache or nginx version: Nginx 1.10.3
PHP version: 7.0

The issue you are facing:
So yesterday I finally migrated to NC14 after a long time of hesitation. Everything works fine apart from the issue described below.

Whenever I open a folder with photos in it, NC starts to create thumbnails, that’s when CPU usage for php7.0-fpm rises to 100% and remains like that for at least a minute. Navigating webui during this time is extremely slow. On NC13 this was never an issue, the thumbnail creation process appeared to have stopped as soon as I got out of the folder with photos.

I did not find anything related on the board, sorry if similar problem has already been reported.
I’ll be very grateful for any assistance.

Is this the first time you’ve seen this error? (Y/N): Yes

Steps to replicate it:

  1. Navigate to a folder with photos in it.
  2. Thumbnail creation starts.
  3. CPU at 100% for a minute or so, everything gets back to normal shortly after. Situation repeats itself every single time.

The output of your Nextcloud log in Admin > Logging:
None
The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

  'datadirectory' => '/DATA',
  'overwrite.cli.url' => 'X',
  'dbtype' => 'mysql',
  'debug' => 'yes',
  'version' => '14.0.3.0',
  'logtimezone' => 'UTC',
  'installed' => true,
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'ncloud',
  'dbpassword' => 'X',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'loglevel' => 1,
  'mail_smtpmode' => 'smtp',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_from_address' => 'X',
  'mail_domain' => 'X',
  'updater.release.channel' => 'stable',
  'maintenance' => false,
  'theme' => '',
  'mail_smtphost' => 'X',
  'mail_smtpport' => 'X',
  'mail_smtpauth' => 1,
  'mail_smtpname' => 'X',
  'mail_smtppassword' => 'X',
  'mail_smtpsecure' => 'ssl',
  'filesystem_check_changes' => 1,
  'quota_include_external_storage' => false,
  'preview_max_x' => NULL,
  'preview_max_y' => NULL,
  'preview_max_scale_factor' => 1,

  'filelocking.enabled' => true,
  'memcache.locking' => '\\OC\Memcache\Redis',
  'redis' => array(
     'host' => '/var/run/redis/redis.sock',
     'port' => 6379,
     'timeout' => 0.0,
      ),

www.conf:

pm.max_children = 40
pm.start_servers = 15
pm.min_spare_servers = 15
pm.max_spare_servers = 25
pm.max_requests = 500

top while problem occurs (varies throughout seconds, usually at 100% CPU and load around over 10.xx - highest was 45.92):

Tasks: 250 total,  10 running, 133 sleeping,  19 stopped,   9 zombie
%Cpu(s): 89.9 us,  9.6 sy,  0.0 ni,  0.2 id,  0.1 wa,  0.0 hi,  0.2 si,  0.0 st
KiB Mem :  7912976 total,  5010192 free,  1537032 used,  1365752 buff/cache
KiB Swap:  3145724 total,  2860028 free,   285696 used.  6086084 avail Mem

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
19446 mysql     20   0  736308  62644   3624 S  36.6  0.8   0:43.72 mysqld
29092 www-data  20   0  673740  74164  25216 R  32.0  0.9   0:04.06 php-fpm7.0
29134 www-data  20   0  642856  45600  27788 S  30.4  0.6   0:04.21 php-fpm7.0
29144 www-data  20   0  682588  77536  27244 R  30.4  1.0   0:03.21 php-fpm7.0
29158 www-data  20   0  688764  88532  27320 S  30.4  1.1   0:04.38 php-fpm7.0
29490 www-data  20   0  638596  41556  27300 S  30.0  0.5   0:01.15 php-fpm7.0
29141 www-data  20   0  640880  41100  25452 S  29.4  0.5   0:04.24 php-fpm7.0
29491 www-data  20   0  638616  39512  25264 S  29.0  0.5   0:01.07 php-fpm7.0
29090 www-data  20   0  673972  75888  27520 R  27.7  1.0   0:04.00 php-fpm7.0
29152 www-data  20   0  640888  45776  29404 S  22.8  0.6   0:03.44 php-fpm7.0
29146 www-data  20   0  676220  75448  25212 R  19.1  1.0   0:03.88 php-fpm7.0
29568 www-data  20   0  676044  74676  24856 R  17.2  0.9   0:00.54 php-fpm7.0
29153 www-data  20   0  703308 106268  27428 R  14.2  1.3   0:03.30 php-fpm7.0
29094 www-data  20   0  713912 115592  27836 S  10.2  1.5   0:03.77 php-fpm7.0
29157 www-data  20   0  672076  72844  25212 R   7.6  0.9   0:03.77 php-fpm7.0
 6114 root       0 -20       0      0      0 I   5.9  0.0   0:45.65 kworker/u17:3-k
29140 www-data  20   0  672120  73416  27704 R   5.0  0.9   0:03.46 php-fpm7.0
 9417 root       0 -20       0      0      0 I   4.0  0.0   0:33.55 kworker/u17:6-k
28928 openmed+  20   0  634568  17792   9576 S   1.7  0.2   0:03.69 php-fpm7.0
29156 www-data  20   0  680552  72792  27312 R   1.7  0.9   0:02.90 php-fpm7.0
  277 root      20   0       0      0      0 S   0.7  0.0   0:17.79 jbd2/sda1-8

Might be worth adding that I have NC set up on openmediavault installation (4.1.12). Issue occurs with NC only, omv webgui does not cause any hiccups whatsoever.

Hi, for my raspberrypi 3 (snap install…) this also occured in as similar way and had the machine going down completely. Unresponsive for hours.
For me the solver of the problem was to deactivate the previews. But that’s not ideal either…
Still trying to figure out what could be done to get the previews activated, but at a very slow priority thus everything else working fine in the meantime. At the moment I’m thinking the www.conf setting might be a way to go. But not tested yet.