[Solved]Cron job hang permanent with no errors (Maps app problem)

Nextcloud version : 18.0.1.3
Operating system and version : Arch Linux
Apache or nginx version : Apache/2.4.41
PHP version : 7.4.2

The issue you are facing:

Systemd timer for cron job hangs, cron job not being executed.
If I switch to webcron and manually open /cron.php from browser, it works.
But systemd timer just create permanently running process:
1574 ? Ss 0:22 /usr/bin/php -f /srv/http/nextcloud/cron.php

Looks like it was broken after update to 18, but i discovered it too late to be sure.

Is this the first time you’ve seen this error? : Y

Steps to replicate it:

  1. Update NC 17 to 18

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!):

<?php
$CONFIG = array (
  'instanceid' => '*',
  'passwordsalt' => '*',
  'datadirectory' => '/srv/data',
  'dbtype' => 'mysql',
  'version' => '18.0.1.3',
  'dbname' => 'cloud',
  'dbhost' => 'hidden',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'cloud',
  'dbpassword' => '*',
  'installed' => true,
  'theme' => '',
  'maintenance' => false,
  'trusted_proxies' => 
  array (
    0 => '172.16.0.1',
  ),
  'trusted_domains' => 
  array (
    0 => 'hidden',
    1 => 'cloud.*.ru',
  ),
  'secret' => '*',
  'loglevel' => 2,
  'log_rotate_size' => 1000000,
  'logtimezone' => 'Europe/Moscow',
  'mail_from_address' => 'noreply',
  'mail_smtpmode' => 'smtp',
  'mail_domain' => '*.ru',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' => 
  array (
    'host' => '/run/redis/redis.sock',
    'port' => 0,
    'timeout' => 0.0,
  ),
  'trashbin_retention_obligation' => 'auto',
  'appstore.experimental.enabled' => true,
  'overwrite.cli.url' => 'http://cloud.*.ru',
  'htaccess.RewriteBase' => '/',
  'mail_smtphost' => 'hidden',
  'mail_smtpauthtype' => 'LOGIN',
  'mysql.utf8mb4' => true,
  'mail_smtpsecure' => 'tls',
  'mail_sendmailmode' => 'smtp',
);

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

[Sun Feb 16 00:00:29.213254 2020] [mpm_prefork:notice] [pid 643] AH00163: Apache/2.4.41 (Unix) OpenSSL/1.1.1d PHP/7.4.2 configured -- resuming normal operations
[Sun Feb 16 00:00:29.213286 2020] [core:notice] [pid 643] AH00094: Command line: '/usr/bin/httpd -D FOREGROUND'

So, I can answer myself.
With NC 18 i have installed some other apps, and I suspect, the Maps app created over 9000M!!! jobs in oc_jobs, with class OCA\Maps\BackgroundJob\AddPhotoJob
I just removed “Maps” app and deleted jobs from table:
DELETE FROM oc_jobs WHERE class LIKE ‘%Maps%’;

Hi, yes, indeed. Had the same problem: Background jobs never end, high cpu mysql, after update 17.0.3 -> 18.0.1

If only I had found your post earlier, would have saved me hours :slight_smile:

Further refining this solution, I took time to more closely examine the 1000’s of jobs I had.

Most of them were created by maps for photo metadata. So in the interest of people not running a scorched earth solution, here is a more refined query:

DELETE FROM oc_jobs WHERE class LIKE '%Maps%' and argument LIKE '%photoId%';

This reduced my Maps jobs from 25000+ to 138.