Is there a way to inspect what cron.php is currently doing?

Nextcloud version: 21.0.1
Operating system and version: Ubuntu 18.04
Apache or nginx version: We use the official docker image for Nextcloud 21.0.1
PHP version: We use the official docker image for Nextcloud 21.0.1

The issue you are facing: Is it possible to inspect what the cron.php is doing? Twice a day (every 12 hours), a long-running, non-terminating cron.php job starts that consumes a lot of CPU resources. After a few days, these overlapping instances consume a significant percentage of the total server CPU, forcing us to restart the container.

To investigate the problem, we would like to know how to find out what this long-running job is doing.

Is this the first time you’ve seen this error? (Y/N):
No, a similar problem had occured a few versions ago. We were not able to identify the reason back then and it disappeared in the meantime.

Steps to replicate it:

  1. Restart container and wait for it to happen.
    We use the cloud mainly to share photos.

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

<?php
$CONFIG = array (
  'htaccess.RewriteBase' => '/',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'filelocking.enabled' => true,
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' => 
  array (
    'host' => 'redis',
  ),
  'apps_paths' => 
  array (
    0 => 
    array (
      'path' => '***',
      'url' => '***',
      'writable' => false,
    ),
    1 => 
    array (
      'path' => '***',
      'url' => '***',
      'writable' => true,
    ),
  ),
  'instanceid' => '***',
  'passwordsalt' => '***',
  'secret' => '***',
  'trusted_domains' => 
  array (
    0 => '***',
  ),
  'trusted_proxies' => 
  array (
    0 => '***',
  ),
  'forwarded_for_headers' => 
  array (
    0 => 'HTTP_FORWARDED_FOR',
  ),
  'datadirectory' => '***',
  'overwrite.cli.url' => '***',
  'dbtype' => 'mysql',
  'version' => '21.0.1.1',
  'dbname' => '***',
  'dbhost' => '***',
  'dbport' => '***',
  'dbtableprefix' => '***',
  'mysql.utf8mb4' => true,
  'dbuser' => '***',
  'dbpassword' => '***',
  'installed' => true,
  'mail_smtpmode' => '***',
  'mail_smtpauthtype' => '***',
  'loglevel' => 1,
  'default_language' => '***',
  'maintenance' => false,
  'mail_from_address' => '***',
  'mail_domain' => '***',
  'updater.release.channel' => 'stable',
  'data-fingerprint' => '***',
  'overwriteprotocol' => 'https',
  'social_login_auto_redirect' => true,
  'app_install_overwrite' => 
  array (
    0 => 'calendar',
    1 => 'sociallogin',
    2 => 'spreed',
  ),
  'mail_sendmailmode' => '***',
  'mail_smtpport' => '***',
);

Apache and Nextcloud log do not contain messages from cron.php

Check the content of the nextcloud.log file, which should provide further information about all kind of Nextcloud releated activities, including the cron execution.

Beside that you can check the “oc_jobs” database table which lists all kind of running background jobs. The available time stamps should allow you to find-out at what time a job has been executd last.

Thank you. Turns out it is the same problem as last year: EmailNotification gets stuck in an endless loop when it fails to send the mails. Any idea how to disable this job? I do not want to disable the Activity App.

Sorry, I cannot help you with this, except to recommend to fix the sending of emails.