Force run adhoc task

Re: Force run adhoc task

by Marie-Eve Lévesque -
Number of replies: 9
Picture of Core developers Picture of Plugin developers

Ok, thanks!

On our side, we had so much entries in the task table (300 000) so we ended up deleting entries in the mdl_adhoc_task and mdl_forum_queue tables (losing notifications). But your solution might be useful if the problem occurs again!

Thanks!

Marie-Eve

In reply to Marie-Eve Lévesque

Re: Force run adhoc task

by Osvaldo Canato -
Hello, Marie-Eve!

I have a similar problem here and I'm thinking of applying your procedure, excluding some entries in mdl_task_adhoc, especially the entries for course_delete_modules.

So my question is what am I going to lose doing this.

You said you missed notifications, but I think this is related to the send_user_notification entries.

What about course_delete_modules entries? Can you tell what happens when they are deleted?

Thanks in advance!

Osvaldo
In reply to Osvaldo Canato

Re: Force run adhoc task

by Christos Savva -
I dont this would be a good idea.

I think the task you are referring is deleting related data of course modules that you have deleted from courses.

For example db entries or files

I think you should not skip those tasks.
In reply to Christos Savva

Re: Force run adhoc task

by Osvaldo Canato -
Thanks for the reply!

The problem is that all tasks (around 20,000) were stucked waiting for those problematic tasks to run.

And I purged caches, looked for error in moodledata/temp/backup/ ... no problem found nowhere.

The only way I could imagine to go on was excluding or postpone the stucked entries.

So, at least for now I decided to postpone and once that was done, tasks finally started to run.

Now I will have to decide what to do with the 26 blocked entries. It is curious: they are all related to 2 courses by the same teacher. It seems that there is a problem with some files that he tried repeatedly to put into activities.

The fact is that these entries seem impossible to perform. Every time they run (by comandline), results in a "PHP Fatal error: Allowed memory size of 4294967296 bytes exhausted". But I have already tried to increase the memory limit even to 7GB per config.php ($CFG->extramemorylimit = '7168;) and it seems that the query only wastes more time, killing when the memory runs out.
In reply to Osvaldo Canato

Re: Force run adhoc task

by Christos Savva -

What is the value you have for memory_limit in your php.ini?

In reply to Christos Savva

Re: Force run adhoc task

by Osvaldo Canato -
It's 256 MB, but it doesn't seem to be related to the problem.

Maybe output_buffering, yes, as it is set to 4096M.

But, the fact is that I can get around what is defined in php.ini using $ CFG-> extramemorylimit" in moodle config.php. So I did that, leaving 7GB for tasks and, after waiting a long time, the result is "" Fatal PHP error: allowed memory size of 7516192768 bytes exhausted "!

That's it!
In reply to Osvaldo Canato

Re: Force run adhoc task

by Manfred Steger -
Hi, thanks a lot to all for the hints to get rid off the problem with the failing ad hoc task. After reading serveral hours through different posts, my solution was disabling the recycle bin in the moodle backend. After that I used the web cron and it works like a charm! Before then the cron stopped always by the ad hoc task: \core_course\task\course_delete_modules. It doesn't matter whether all modul plugins turned off.

There are two big problems if the cron failed at this point:

  • no forum post messages were sent
  • setup for grades have orphan entries and there is a warning message something like "deletion in progress". Grades are unusable at this point if you delete a activity.
If you encounter one of those problems, maybe it's the failing cron job. This issue costs me several days of work, maybe not that time assuming for a developer but i am a teacher.

Cron script completed correctly
Cron completed at 07:26:50. Memory used 4.9MB.
Execution took 0.15051 seconds


Average of ratings: Useful (1)
In reply to Manfred Steger

Re: Force run adhoc task

by Dr. Nellie Deutsch -
Where did you disable the recycle bin exactly?
In reply to Dr. Nellie Deutsch

Re: Force run adhoc task

by Dr. Nellie Deutsch -

mdl_task_adhoc are failing

In reply to Dr. Nellie Deutsch

Re: Force run adhoc task

by Ken Task -
Picture of Particularly helpful Moodlers

@Dr. Nellie ...

PIggy-backed (even if related) reporting of an issue isn't a good idea.   IF true, suggest posting a new thread with description of your problem/issues.  Proposed Subject line? "mdl_task_adhoc are failing" then provide some details as well as server info - mdl version, etc.

Your problems deserve focused attention of those who might respond.

2 cents ...

'SoS', Ken