One Adhoc task failing -> [Deletion in progress] for all modules

One Adhoc task failing -> [Deletion in progress] for all modules

Susana L. -
回帖数:13
Particularly helpful Moodlers的头像

Hi,

We are having a problem with the deletion of modules in a course. We have an adhoc task failing to delete a module in a course and because of that all the other modules from that course are not being deleted. We get several items in the course grade book labeled [Deletion in progress].

  • Checking the mdl_task_adhoc table, I get 3 items with faildelay 24h and classname \core_course\task\course_delete_modules.
  • Checking the cron log, I can confirm the problem: "Adhoc task failed: core_course\task\course_delete_modules... The course module xxxx could not be deleted."
  • Checking mdl_course_modules for that module, I could understand it is a turnitintooltwo module that is causing the issue and I noticed that the "instance" field is '0'.
  • I was not able to find the module when looking for the module instance in mdl_turnitintooltwo table.
  • I suspect it must be some problem with turnitintwotool module related to the restore process...

Anyway, my question is:

Why is the deleting process stuck because of a problem in a module? What should I do to get the deleting process to proceed in order all other deleted modules in that course are actually deleted?

Anyone?

Thank you!
susana

PS: Moodle 3.5 - PostgreSQL

回复Susana L.

Re: One Adhoc task failing -> [Deletion in progress] for all modules

Susana L. -
Particularly helpful Moodlers的头像

Does anyone have problems with  [Deletion in progress] items on gradebook?

It seems that because of a problem deleting one of the course modules we will have "deletion in progress" forever for all other course modules we want to delete... Is this the expected behaviour?

Thank you!

回复Susana L.

Re: One Adhoc task failing -> [Deletion in progress] for all modules

Susana L. -
Particularly helpful Moodlers的头像

The problem was solved updating customdata field from mdl_task_adhoc, removing the module id that is causing the error from the list of modules in customdata field. We had to intervene directly in moodle database.

回复Susana L.

Re: One Adhoc task failing -> [Deletion in progress] for all modules

Moisés Campos Zavala -

I get the following error in cron in moodle 3.6.3:


Adhoc task failed: core_course\task\course_delete_modules,Detectado un error de codificación, debe ser corregido por un programador: The course module 278134 could not be deleted. #0 /home/produccion/public_html/admin/tool/recyclebin/lib.php(151): tool_recyclebin\course_bin->store_item(Object(stdClass))

#1 /home/produccion/public_html/course/lib.php(1141): tool_recyclebin_pre_course_module_delete(Object(stdClass))

#2 /home/produccion/public_html/course/classes/task/course_delete_modules.php(66): course_delete_module('278134')

#3 /home/produccion/public_html/lib/cronlib.php(185): core_course\task\course_delete_modules->execute()

#4 /home/produccion/public_html/lib/cronlib.php(74): cron_run_inner_adhoc_task(Object(core_course\task\course_delete_modules))

#5 /home/produccion/public_html/admin/cron.php(81): cron_run()

#6 {main}


With the following query, I located the indicated record: SELECT * FROM `mdl_task_adhoc` WHERE customdata like '% 278134%'


{"cms":[{"id":"278134","course":"5146","module":"17"........


I understand that I will delete the following value: "id": "278134" leaving it like this: "id": ""

Confirm please. Thank you.

回复Moisés Campos Zavala

Re: One Adhoc task failing -> [Deletion in progress] for all modules

Susana L. -
Particularly helpful Moodlers的头像

Hi Moisés,

My customdata was something like:
{"cms":{"52650":{"id":"52650"},"52651":{"id":"52651"},"52652":{"id":"52652"},"52667":{"id":"52667"},"52668":{"id":"52668"}....

 What I did was remove the entire "52667":{"id":"52667"}. So I updated the field to something like:
{"cms":{"52650":{"id":"52650"},"52651":{"id":"52651"},"52652":{"id":"52652"},"52668":{"id":"52668"}....

In my case I removed the entire record related to that id.

Best,
susana

回复Susana L.

Re: One Adhoc task failing -> [Deletion in progress] for all modules

Jerry Lau -

Hi Susana.

What do you mean by deleting the entire record related to it? Which table or tables are you referring to?


Thanks


回复Jerry Lau

Re: One Adhoc task failing -> [Deletion in progress] for all modules

Susana L. -
Particularly helpful Moodlers的头像

Hi Jerry,

For instance, you don't want the task to delete the module 52655. Here's what I did:

select id,customdata from mdl_task_adhoc where id=36893;
id | customdata ---------------- 36893 | {"cms":{"52650":{"id":"52650"},"52651":{"id":"52651"},"52652":{"id":"52652"},"52653":{"id":"52653"},"52654":{"id":"52654"},"52655":{"id":"52655"},"52739":{"id":"52739"}},"userid":"3094","realuserid":"3094"}
update mdl_task_adhoc set customdata = '{"cms":{"52650":{"id":"52650"},"52651":{"id":"52651"},"52652":{"id":"52652"},"52653":{"id":"52653"},"52654":{"id":"52654"},"52739":{"id":"52739"}},"userid":"3094","realuserid":"3094"}' where id=36893;

So, I removed the reference to 52655 from the list of modules.

Best!
susana

回复Susana L.

Re: One Adhoc task failing -> [Deletion in progress] for all modules

Jerry Lau -

Ah yes.. that is what I thought.. you just copied the original data and removed the offending modules in the query string.

But if you remove it, how do you know if the removed module(s) is actually removed or behaving properly?

Thanks

回复Jerry Lau

Re: One Adhoc task failing -> [Deletion in progress] for all modules

Susana L. -
Particularly helpful Moodlers的头像

In my case, the "offending modules" were not visible anywhere. I actually did not solve any problem with that modules because they were not shown to the user. It seems they were deleted before but, for some reason, still appearing in that list (customdata field, mdl_task_adhoc table).

So after suppressing those "offending modules" from the list of modules, the scheduled task no longer fails at the scheduled time and all the other modules from the list are actually removed. The whole entry is also removed from mdl_task_adhoc table and the modules which had "deletion in progress" label before finally disappear from gradebook... that was my real problem.

This is more of a workaround than a proper solution...

What should be really done:

  1. Understand the problem with that external module and correct it;
  2. Propose a solution for moodle in order to keep the deletion task of the modules even if it finds any problematic module.

Best,
susana

回复Susana L.

Re: One Adhoc task failing -> [Deletion in progress] for all modules

Paul Lindgreen -

I have the same warning in the gradebook after 24hr and have found several offending modules in my cron logs (10-15) , is there any downside risk to removing them all from the mdl_task_athoc ? What risk is associated with removing modules here?

My mdl_task_athoc table is somewhat lengthy, should I focus on every record that references the offending modules or should they all be found in 1 record?

Will this adversely effect anything else in moodle? From what I can see now it 1] prevents the Recycle Bin from working and 2] displays the warning in the gradebook to teachers for deleted Quizzes? Are any other cron jobs not being run?

I suspect the problem is related to 1-2 plugins that didnt uninstall properly in the past. I tried uninstalling one of them again but got a 503 error while in moodle 3.3.6, since then I have upgraded to 3.5.5 should I try uninstalling the plugin again (its currently 'missing from disk') ?

回复Paul Lindgreen

Re: One Adhoc task failing -> [Deletion in progress] for all modules

Paul Lindgreen -

Is another workaround Disabling the Recycle Bin, or will the warning still appear in the Gradebook?

If this can mitigate the problem I can live without the recycle bin (Ill miss it!) if that ensures everything else functions as expected.

回复Paul Lindgreen

Re: One Adhoc task failing -> [Deletion in progress] for all modules

Jerry Lau -

I would make a copy of the production to a test system. everything must be the same include os, moodle version/build, php, db, web server, etc. and configuration settings

In the test system, uninstall the offending module and install the newer versions.

They run the cron.php again for a few days.. if you still see it in the adhoc_task table, I would remove the offending one.

You can also contact the developer of the plugin and let them know what is going on.

good luck

回复Jerry Lau

Re: One Adhoc task failing -> [Deletion in progress] for all modules

Paul Lindgreen -

Fresh install of moodle 3.5.5 and we are getting the error again, 伤心

has moodle addressed this problem in newer versions?

回复Susana L.

Re: One Adhoc task failing -> [Deletion in progress] for all modules

Paul Lindgreen -
my problem was resolved in a Moodle Tracker here:
https://tracker.moodle.org/browse/MDL-65218?attachmentViewMode=list

the issue was related to the course automated backup location, if it was a specific drive the Recycle bin fails, if its the course file area and specific drive it will work as expected, moodle course file area required. looks like it was a bug thats fixed post moodle 3.5.5, hoping the next upgrade will remedy the situation