Cron.php running erratically

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:

example

Or for longer, use three backticks above and below the code snippet:

longer
example
here

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:

Nextcloud version (eg, 20.0.5): 25.0.3
Operating system and version (eg, Ubuntu 20.04): Rasbperry Pi 4 - Bullseye
Apache or nginx version (eg, Apache 2.4.25): Apache/2.4.54 (Debian)
PHP version (eg, 7.4): 8.1.14

The issue you are facing:
cron.php scheduled via user www-data crontab runs erratically:

1st run - completes in under 5 minutes - admin logging normal (normal period)
2nd run - completes in around 50 minutes - no admin logging info (problem period)
3rd run - completes in under 5 minutes - admin logging normal (normal period)
4th run - completes in around 50 minutes - no admin logging info (problem period)
.
.
.
(sequence repeats)

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

Steps to replicate it:

  1. Enable cron job to run cron.php
  2. Monitor system while job running
  3. Disable cron job

The output of your Nextcloud log in Admin > Logging:

No logging information during problem period

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

<?php
$CONFIG = array (
  'instanceid' => 'ocf7jxn61vvj',
  'passwordsalt' => 'PFdneMiqBV3NM/V+ZczRWgvFAE8R8Z',
  'secret' => '/2z40Fs7PuPC2p1t3m9wsoUddWtU0MsKIooTlKBNna44b/WX',
  'trusted_domains' =>
  array (
    0 => 'bullcloud.duckdns.org',
  ),
  'datadirectory' => '/mnt/external/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '25.0.3.2',
  'overwrite.cli.url' => 'https://bullcloud.duckdns.org/nextcloud',
  'dbname' => 'nextclouddb',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextclouduser',
  'dbpassword' => '*******',
  'installed' => true,
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'preview_max_x' => 1024,
  'preview_max_y' => 1024,
  'maintenance' => false,
  'theme' => '',
  'loglevel' => 0,
  'updater.secret' => '$2y$10$BITVE1HAi0fQaMakiwAGAOx1cSuyHb4sFYlhLA372vD6IC0kgo
Mli',
);

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

(N/A)

Output errors in nextcloud.log in /var/www/ or as admin user in top right menu, filtering for errors. Use a pastebin service if necessary.

No errors in log, nothing newin log during problem period

Having updates to this post, and wanting to ask some questions, in the hope of sparking a conversation:

I have scheduled the cron job that runs cron.php every two hours. This is working for now, but I would really like to be able to run it more frequently. Since every other run takes at least 50 minutes, I cannot assume it will be done in an hour, and so using the two hour interval. Nothing is stopping cron.php from running more than one at a time, and I have seen the system spiral down to no memory left if too many cron.php jobs are running at the same time.

During the problem period when cron.php runs for at least 50 minutes, about 100% of one CPU is being used between php and mariadbd, mostly by php. I would like to find out what cron.php is doing during this long run. As mentioned previously, nothing shows up in nextcloud.log during the problem period.

Questions:

  1. How can I find out what cron.php is doing during the problem period?
  2. Is there a compatibility problem with nextcloud and php version 8.1.4?