General developer forum

Moodle cron service error (xml_parser_create)

 
Picture of James Bisset
Moodle cron service error (xml_parser_create)
 

I'm a Moodle admin not a developer, so apologies if this is not the correct place to post this.  However, my problem appears to be closely related to https://moodle.org/mod/forum/discuss.php?d=340314 so I figured some participants in this forums may be well placed to help.

The problem is with the Moodle cron service which I am using to back up the SQL database, moodle files and individual courses.

Here's the crontab entry for www-data:

*/3 * * * *     /usr/bin/php /var/www/moodle/admin/cli/cron.php >/dev/null

0 5 * * *       /bin/bash /etc/moodle/moodle-sql-backup.sh > /tmp/www-data-cron.txt

The shell script works fine, but I'm getting the info below by notification email every 3 minutes resulting from the cron.php entry.  I'm afraid it doesn't mean an awful lot to me, so if anyone can point me in the right direction that would be helpful.

My server specs: Moodle 3.4.2+ (Build: 20180329) Version 2017111302.03 
Ubuntu 14.04 (moodle14-04 3.13.0-85-generic #129-Ubuntu)
PHP Version 7.1.12-3+ubuntu14.04.1+deb.sury.org+1

James Bisset


Default exception handler: Exception - Call to undefined function xml_parser_create() Debug:

Error code: generalexceptionmessage

* line 80 of /backup/util/xml/parser/progressive_parser.class.php: Error thrown

* line 135 of /backup/util/helper/backup_general_helper.class.php: call to progressive_parser->__construct()

* line 280 of /backup/util/helper/backup_general_helper.class.php: call to backup_general_helper::get_backup_information()

* line 652 of /backup/util/helper/backup_cron_helper.class.php: call to backup_general_helper::get_backup_information_from_mbz()

* line 578 of /backup/util/helper/backup_cron_helper.class.php: call to backup_cron_automated_helper::remove_excess_backups_from_directory()

* line 219 of /backup/util/helper/backup_cron_helper.class.php: call to backup_cron_automated_helper::remove_excess_backups()

* line 50 of /lib/classes/task/automated_backup_task.php: call to backup_cron_automated_helper::run_automated_backup()

* line 104 of /lib/cronlib.php: call to core\task\automated_backup_task->execute()

* line 67 of /lib/cronlib.php: call to cron_run_inner_scheduled_task()

* line 61 of /admin/cli/cron.php: call to cron_run()

 

PHP Fatal error:  Uncaught coding_exception: Coding error detected, it must be fixed by a programmer: A lock was created but not released at:

/var/www/moodle/lib/classes/task/manager.php on line 542

 

 Code should look like:

 

 $factory = \core\lock\lock_config::get_lock_factory('type');

 $lock = $factory->get_lock(Resource id #641);  $lock->release();  // Locks must ALWAYS be released like this.

 

 in /var/www/moodle/lib/classes/lock/lock.php:117

Stack trace:

#0 [internal function]: core\lock\lock->__destruct()

#1 {main}

  thrown in /var/www/moodle/lib/classes/lock/lock.php on line 117


 
Average of ratings: -
Tim at Lone Pine Koala Sanctuary
Re: Moodle cron service error (xml_parser_create)
Core developersDocumentation writersParticularly helpful MoodlersPlugin developers

When you run PHP from the command-line it does not necessarily use the same configuration as when run by apache.

Compare the output from php -i on the command line, with Admin -> Server -> PHP info in the Moodle interface (in particular the Loaded Configuration File value, which is the path to the php.ini file used).

 
Average of ratings: -