Problem with deleting a course in Cron; possible related issue of ad hoc tasks not running and auto back-ups

Problem with deleting a course in Cron; possible related issue of ad hoc tasks not running and auto back-ups

by Robert Malpas -
Number of replies: 2
Hi,

I'm new to Moodle and have been getting on reasonably well solving issues as they arise. I'm not an expert programmer.

I have four potentially related issues.

The first is that I'm getting an error message in my Cron log as follows:

Adhoc task failed: core_course\task\course_delete_modules,Coding error detected, it must be fixed by a programmer: The course module 79 could not be deleted.

Then in "Server/Tasks/Tasks running now" there is a record:

core_course\task\course_delete_modules which seems to be always running.

Then in Reports/System Status I have an error message relating to the Ad hoc Task Queue which states:

Oldest task is 15 days 22 hours which is more than 4 hours

And finally in my automated course backups report, all course backups are listed as "Queued", and have been like that for about the same length of time as the ad hoc task error.

I'm thinking that all these issues are potentially related. I've looked around for possible solutions but have failed. Do you have any advice on resolving these issues as I'd like to get the ad hoc tasks and automated course backups running again?

Thanks for any advice.
Average of ratings: -
In reply to Robert Malpas

Re: Problem with deleting a course in Cron; possible related issue of ad hoc tasks not running and auto back-ups

by Robert Malpas -
Some additional information on my issue.

I'm running Moodle version 3.10.1+ (Build: 20210122).

Taking ideas from other similar incidents that have been reported, I looked at the "task_adhoc" database table and found the following:



The first row of the table relates to Course #79 which is bringing the error in the cron job log. It has been running for a long time! So the question is, can I simply delete this row in the table, as I think has been done by others, or do I have to get to the root cause of the problem? I'm not keen to delete a row in this database table if this could cause even greater problems.

Thanks for any advice.
In reply to Robert Malpas

Re: Problem with deleting a course in Cron; possible related issue of ad hoc tasks not running and auto back-ups

by Robert Malpas -
Well, I took the plunge and deleted the first line in the task_adhoc database as shown in the previous post that seemed to be causing the problem. And once that was done, all the ad hoc tasks cleared themselves, I no longer get an error message in the cron report, and my automated back-ups are all running fine again. Only time will tell whether there are any long term issues arising from this, but all looks good for now at least.