OOM when running occ db:add-missing-indices after upgrade to NC 21

Nextcloud version (eg, 20.0.5): 21.0.0
Operating system and version (eg, Ubuntu 20.04): Debian 10
Apache or nginx version (eg, Apache 2.4.25): 2.4.38
PHP version (eg, 7.4): 7.3

The issue you are facing:

After upgrading to NC 21, I see that index “fs_size” in table “oc_filecache” is missing.

After running occ db:add-missing-indices, I get (consistently):

root@vps-9450fc23:/var/www/nextcloud# sudo -u www-data php occ db:add-missing-indices

mmap() failed: [12] Cannot allocate memory
PHP Fatal error:  Out of memory (allocated 3164602368) (tried to allocate 20480 bytes) in /var/www/nextcloud/lib/private/AppFramework/Utilit                 y/SimpleContainer.php on line 133

Is this the first time you’ve seen this error? Yes

The output of your Nextcloud log in Admin > Logging:

Still waiting for this page to render

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

<?php
$CONFIG = array (
  'instanceid' => xxxxxxxxxxxxxxxx
  'passwordsalt' => 'HA256xxxxxxxxxxxxxxxxxxxxxx',
  'secret' => 'xxxxxxxxxxxxxxxxxxxxxxxx',
  'trusted_domains' =>
  array (
    0 => 'nextcloud.acme.org',
  ),
  'datadirectory' => '/var/www/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '21.0.0.18',
  'debug' => true,
  'log_type' => 'syslog',
  'logfile' => '',
  'loglevel' => 0,
  'overwrite.cli.url' => 'https://nextcloud.acme.org',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost:3306',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'oc_admin',
  'dbpassword' => 'xxxxxxxxxxxxxxxxxxx',
  'installed' => true,
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'mail_smtpmode' => 'smtp',
  'mail_smtphost' => 'nextcloud.acme.org',
  'mail_smtpport' => '25',
  'mail_from_address' => 'nextcloud',
  'mail_domain' => 'acme.org',
  'maintenance' => false,
  'updater.release.channel' => 'beta',
  'theme' => '',
  'mail_sendmailmode' => 'smtp',
  'mail_smtpsecure' => 'tls',
  'app_install_overwrite' =>
  array (
    0 => 'calendar',
    1 => 'issuetemplate',
    2 => 'spreed',
    3 => 'social',
    4 => 'contacts',
    5 => 'files_markdown',
    6 => 'files_texteditor',
    7 => 'polls',
  ),
  'updater.secret' => 'xxxxxxxxxxxxxxxxxxxxxx',
);

The output of your Apache/nginx/system log in /var/log/____:

Nothing in here. Neither in /var/log/syslog

Hi @StCyr how many ram is allocated for PHP ? ( see your php.ini)

memory_limit = -1 in /etc/php/7.3/cli/php.ini

The OOM error message shows that occ allocates all my free memory ( “allocated 3164602368”)

and, just in case:

memory_limit = 512M in /etc/php/7.3/fpm/php.ini
memory_limit = 128M in /etc/php/7.3/apache2/php.ini

try removing 'memcache.local' => '\\OC\\Memcache\\APCu', from your config.

Fixed it for me, see this thread Nextcloud 21 - update needed - #33 by swindhab

4 Likes

Hey?! That fixed it. Thanks!

I had the same issue, this solution fixed the problem for me too

+1 this worked for me too.

I confirm it. That fixed the problem for me as well!

worked for me as well, thanks