refresh_forum_post_counts repeats itself 'forever' in cron

refresh_forum_post_counts repeats itself 'forever' in cron

by Johan Myny -
Number of replies: 10

I've just upgraded en migrated our Moodelserver to Centos 8.

When I run the cronjob manually, if first executes some tasks and ends with a continuous stream of messages like these:

Execute adhoc task: mod_forum\task\refresh_forum_post_counts
... started 15:07:56. Current memory use 40.5MB.
... used 5002 dbqueries
... used 0.57830691337585 seconds
Adhoc task complete: mod_forum\task\refresh_forum_post_counts

Execute adhoc task: mod_forum\task\refresh_forum_post_counts
... started 15:07:57. Current memory use 40.5MB.
... used 5002 dbqueries
... used 0.57928895950317 seconds
Adhoc task complete: mod_forum\task\refresh_forum_post_counts

This goes on and on and on, reducing the performance of the server.

It either stops after 30 minutes  with Stopping processing of adhoc tasks as time limit has been reached  (which used to be the maximum execution time of a script in php.ini), or crashes sad

I've nw changed the max execution time to 20 seconds, but the process still repeats itself for many minutes.

Is this normal behavior?

Second question: is it really ok to repeat the cronjob every minute, even when some cronjobs take way longer to complete (e.g. in order to make an auto-backup of  a large course)

Johan

Average of ratings: -
In reply to Johan Myny

How do I resolve this??

by Michael Adewusi -

php_extensionintl

Intl extension is required to improve internationalization support, such as locale aware sorting and international domain names.

Check

In reply to Michael Adewusi

Re: How do I resolve this??

by Ken Task -
Picture of Particularly helpful Moodlers

Use your package manager (operating system) and install php-intl?

If remotely hosted, ask technical support with provider for info on how to install a php extension.

'SoS', Ken

In reply to Michael Adewusi

Re: How do I resolve this??

by Usman Asar -
Picture of Plugin developers Picture of Testers

Michael, open up a new post.

check your PHP settings, you need to enable intl extension, or ask your hosting provider how to enable extensions.

In reply to Michael Adewusi

Re: How do I resolve this??

by Johan Myny -
Thank you for you (consistent  ) answers! Unfortunately, the php-intl extension has already been installed on the server.
This is what I get from php-info:

php intl info

and in php.ini I find

[intl]
;intl.default_locale =
; This directive allows you to produce PHP errors when some error
; happens within intl functions. The value is the level of the error produced.
; Default is 0, which does not produce any errors.
;intl.error_level = E_WARNING
intl.use_exceptions = E_WARNING


Anything suspicious here? Should intl.default_locale have a value?

Kind regards
Johan

In reply to Johan Myny

Re: How do I resolve this??

by Marcus Green -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
That will be on the version of PHP that runs in your browser, but it might not be set for the cli version.

Typically there are two versions of php on a system that use two different php.ini files. One for your web browser and one for running from the command line (CLI)

I am not sure which version cron runs, but if you can check that someone else may come along and answer that question. You should be able to do a php -i from the commmand line and capture the output, e.g. php -i > out.txt and then look through that file for intl.
In reply to Marcus Green

Re: How do I resolve this??

by Johan Myny -
Hello Marcus

Thanks for your reply.
I've tried php -i and php-m and they both show that the intl-extension has been installed.

I've searched the output of php -i for additional ini-files, but basically only found /etc/php.ini and the ini-files of the extensions (including intl.ini)

phpinfo()
PHP Version => 7.2.24
System => Linux cvo-prd-web-02 4.18.0-193.6.3.el8_2.x86_64 #1 SMP Wed Jun 10 11:09:32 UTC 2020 x86_64
Build Date => Oct 22 2019 08:28:36
Server API => Command Line Interface
Virtual Directory Support => disabled
Configuration File (php.ini) Path => /etc
Loaded Configuration File => /etc/php.ini
Scan this dir for additional .ini files => /etc/php.d
Additional .ini files parsed => /etc/php.d/20-bz2.ini,
/etc/php.d/20-calendar.ini,
/etc/php.d/20-ctype.ini,
/etc/php.d/20-curl.ini,
/etc/php.d/20-dom.ini,
/etc/php.d/20-exif.ini,
/etc/php.d/20-fileinfo.ini,
/etc/php.d/20-ftp.ini,
/etc/php.d/20-gd.ini,
/etc/php.d/20-gettext.ini,
/etc/php.d/20-iconv.ini,
/etc/php.d/20-intl.ini,
/etc/php.d/20-json.ini,
/etc/php.d/20-mbstring.ini,
/etc/php.d/20-mysqlnd.ini,
/etc/php.d/20-pdo.ini,
/etc/php.d/20-phar.ini,
/etc/php.d/20-simplexml.ini,
/etc/php.d/20-soap.ini,
/etc/php.d/20-sockets.ini,
/etc/php.d/20-sqlite3.ini,
/etc/php.d/20-tokenizer.ini,
/etc/php.d/20-xml.ini,
/etc/php.d/20-xmlwriter.ini,
/etc/php.d/20-xsl.ini,
/etc/php.d/30-mysqli.ini,
/etc/php.d/30-pdo_mysql.ini,
/etc/php.d/30-pdo_sqlite.ini,
/etc/php.d/30-wddx.ini,
/etc/php.d/30-xmlreader.ini,
/etc/php.d/30-xmlrpc.ini,
/etc/php.d/40-zip.ini


I find no trace of a second php-inifile.

Running on Centos 8.

I start the cronjob  this way:  /usr/bin/php /data/www/moodle/admin/cli/cron.php

Johan

In reply to Johan Myny

Re: How do I resolve this??

by Marcus Green -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
How is debug set in debug setting of admin?
In reply to Marcus Green

Re: How do I resolve this??

by Johan Myny -
It was set to 'None'.
I've changed it to 'Normal'.
But I run the cronjob from the command line (Centos 8), so I don't expect to see any errors...
In reply to Marcus Green

Re: How do I resolve this??

by Johan Myny -
Back again with the next episode of this problem. At first, changing the debug setting of admin seemed to have solved the problem: four consecutive runs of the cron-job ended normally (althoug auto-back-ups take a long time to complete). Yesterday night I re-enabled the cronjob. Today, the hosting company warned me again that our server is eating too much resources sad
mysql is now at 67% of cpu-power. As the cronjob is restarted every 15 minutes and takes half an hour to repeat the mod_forum\task\refresh_forum_post_counts, our server is constantly working hard and we risk being punished for this situation...
Any help would be appreciated!
Johan
In reply to Johan Myny

Re: How do I resolve this??

by Vincent Basile -
I'm currently experiencing this same issue, did you ever find a fix for this?

Thanks,

Vinny