Completion Report - Cron Issues Version 2.2.1

Completion Report - Cron Issues Version 2.2.1

by Kyle Egan -
Number of replies: 12

I recently changed the completion criteria in a course which meant I had to: 'delete completion data'. I have done this before and then by running the cron it usually checks against the new criteria and re-populates the completion data. Although in this case my cron runs and gets to: 'Running completion_criteria_activity->cron()' then hangs for an hour then finally spits out an IE 'can't find page error'.  I have attached the cron script where it hangs. The issue is causing all completion dependent report script to crash the server.

+ I tried Resetting the completion criteria on the course but the data was already deleted so no good- no change.
+ I then tried updating a copy of the database to Moodle 2.2.2 sticking to a pure Moodle Stable site i.e. No hacks. Although same issue occured (Cron hangs at 'Running completion_criteria_activity->cron()' and Completion Reports crash the server).
+ I have also tried the patch [MDL-32203]. (applied manually no errors) - still nothing.
+ I checked most databases tables for duplicate records including ('mdl_course_completion_crit_compl' etc). Still same issue.
+ I have also tryed uping the max 'max_script_run_time' variable in the PHP - Nothing (Actually it still only ran for a hour i.e. no increase in time).

Also the cronn runs all the way through if I edit out the completion cron code from 'moodle/lib/completion/cron.php' and even with developer debugging on I get no stack errors etc - Nothing it just eventually times out.

Please Help - I can't think of anything else to try.

My Cron Script, where it stops.

Average of ratings: -
In reply to Kyle Egan

Re: Completion Report - Cron Issues Version 2.2.1

by Aaron Barnes -

Hi Kyle,

This is a strange one! From what I can see it sounds like either an issue with how completion handles some of the activities in this course, or you have a huge amount of data in your database?

Could you try updating the completion criteria by unticking anything under "Activities completed" and resaving (resetting data if it required)? I'd be interested to know whether this fixes the issue.

Also, if you could supply any more details e.g. a screenshot of the course's criteria, any error messages, etc that would be great.

Thanks and good luck,
Aaron

In reply to Aaron Barnes

Re: Completion Report - Cron Issues Version 2.2.1

by Kyle Egan -

Hi Aaron,

Thanks for replying. Ok the answer to your question is: no. I went into the completion criteria of the course I 'Unlock completion options and delete user completion data' for previously and removed all completion criteria then saved it. Then tried running the cron again.

The cron did look different as it marked all the users in the course as started, although still stopped at the running 'completion_criteria_activity->cron()' I looked in the course_completions table and there are no records in that course that have the timecompleted populated. Important also to note that the first time I went to the course completion settings for the course it crashed the server, I restarted the server unticked all like recomended saved successfully, then tried the cron as reported etc but then tried to reassign criteria to it then it crashed the server again.

Cron change:

Marked started user 5 in course 2

Marked started user 24 in course 2

Marked started user 27 in course 2

Marked started user 373 in course 2

Marked started user 375 in course 2

Marked started user 377 in course 2

Marked started user 378 in course 2

Marked started user 379 in course 2

etc... etc....etc.....

 

What Database table are the completion criteria for each course saved in?

In reply to Kyle Egan

Re: Completion Report - Cron Issues Version 2.2.1

by Kyle Egan -

Never mind about the last question I looked at table 'course_completion_criteria' and there is no criteria for course 2 (which seems to be the issue). Which is what I would expect. I'm going to try remove all the criteria from all courses and see if that works.

In reply to Aaron Barnes

Re: Completion Report - Cron Issues Version 2.2.1

by Kyle Egan -

Ok I have sort of fixed it, what I did was mass delete all the completion criteria out of each course that contained completion data then ran the cron - the cron completed sucessfully. Then I re-applied the completion criteria starting with my larger courses one at a time then running the cron.php after each a couple of times. At this point I found that there is a course that this dosen't work for (probably a dogy activityid) I tried just deleting the course criteria out of that course that diden't work in this process in my live moodle site and it ran like a dream. - Now I just have to isolate the activity in that course that is playing up.

Anyone know what could have caused this to happen in the first place? I haden't changed anything in the course that stuffed up in months.

Average of ratings: Useful (1)
In reply to Kyle Egan

Re: Completion Report - Cron Issues Version 2.2.1

by Kyle Egan -
I have received this error a couple of times in the cron which I have been finding the buggy activity, not sure if this is the reason behind my greif. ++ The object could not be used in its state to retrieve a matching record from the DB, because its id field is not set. ++ * line 280 of \lib\completion\data_object.php: call to debugging() * line 266 of \lib\completion\data_object.php: call to data_object->update_from_db() * line 240 of \lib\completion\completion_completion.php: call to data_object->insert() * line 150 of \lib\completion\completion_completion.php: call to completion_completion->_save() * line 175 of \lib\completion\cron.php: call to completion_completion->mark_enrolled() * line 41 of \lib\completion\cron.php: call to completion_cron_mark_started() * line 351 of \lib\cronlib.php: call to completion_cron() * line 85 of \admin\cron.php: call to cron_run()
Average of ratings: Useful (1)
In reply to Kyle Egan

Re: Completion Report - Cron Issues Version 2.2.1

by Aaron Barnes -

Hi,

I don't believe this to be the cause, are you still running the patch from MDL-32203?

Thanks again,
Aaron 

In reply to Aaron Barnes

Re: Completion Report - Cron Issues Version 2.2.1

by Kyle Egan -

No just installed it to check if it [MDL-32203] would fix the issue then replaced it with the clean Moodle stable. Yeah it looks like it happens where I have deleted a user. No biggy.

I'm struggling to find the broken activity it crashes every other time I try add activities to the completion criteria - no consstancy. Might leave it for today.

In reply to Kyle Egan

Re: Completion Report - Cron Issues Version 2.2.1

by Aaron Barnes -

Hi Kyle,

Any chance you could get a backup of the affected course for me? My email address is aaron.barnes@hbcosmo.com

I have some ideas but struggling to reproduce the error locally.

Cheers,
Aaron

In reply to Aaron Barnes

Re: Completion Report - Cron Issues Version 2.2.1

by Kyle Egan -

Hi Aaron,

Sorry I have been working on other things, I'm still having this issue. I've just tried to back the course up but It has crashed the server I'll try to take out user data and see if that works. If I can get a back up of the course I'll flick it to the email you have listed today.

In reply to Kyle Egan

Re: Completion Report - Cron Issues Version 2.2.2

by Kyle Egan -

I now have 2 courses with this issue, I'm unable to back up these courses either. Basicly I cannot add course criteria to either course without the cron breaking. At the point mentioned in my first post. The only way I can keep the cron runninf is to remove all completion criteria from these 2 courses.

I have checked and there is no duplicate data in 'mdl_course_completion_aggr_methd' or 'mdl_course_completion_crit_compl' or 'mdl_course_completion_criteria' or 'mdl_course_completions'.

I used the mentioned:

SELECT course, count(id)
----

HAVING COUNT(id) > 1

Please Help!

In reply to Kyle Egan

Re: Completion Report - Cron Issues Version 2.2.2

by Aaron Barnes -

Hey Kyle,

That patch I replied to you on in the tracker should fix the issues you are having once and for all smile

Thanks,
Aaron

In reply to Kyle Egan

Re: Completion Report - Cron Issues Version 2.2.1

by Aaron Barnes -

Hi Kyle,

Not sure what is causing this, but I am determined to fix it! I know of at least one other user this is effecting.

Keep narrowing it down and I'll make sure you have a patch to fix it - your help has been invaluable!

Thanks so much,
Aaron