Moodle

Cron - "Deleted assignment" or not woking?

Details

  • Type: Bug Bug
  • Status: Open Open
  • Priority: Minor Minor
  • Resolution: Unresolved
  • Affects Version/s: 1.8.2
  • Fix Version/s: None
  • Component/s: Unknown
  • Labels:
    None
  • Database:
    MySQL
  • Affected Branches:
    MOODLE_18_STABLE

Description

Cron - "Deleted assignment" or not woking?

Discussion in... http://moodle.org/mod/forum/discuss.php?d=77088

Mr Alexander Kou and myself... when we run... multiple times...

"php /usr/local/www/data/moodle/admin/cron.php"

We see the same "Deleted assignment" statements each time... and people do not get unenrolled from the courses...

Deleted assignment for user 4 from course 23
Deleted assignment for user 1 from course 9
Deleted assignment for user 8 from course 4
Deleted assignment for user 107 from course 16
Deleted assignment for user 235 from course 35
Deleted assignment for user 109 from course 97
Deleted assignment for user 438 from course 38
....

Activity

Hide
Antony O'Sullivan added a comment -

I just looked at my system... with a 150 day auto delete setting... and I got a user with:

Courses: Angela Carter 'Wise Children', Governement and Politics - A1, As Business Studies Module 1 Marketing Accounting and Finance
Last access: Friday, 24 November 2006, 11:20 AM (256 days 10 hours)

This CRON thing has not been working for some time!

Show
Antony O'Sullivan added a comment - I just looked at my system... with a 150 day auto delete setting... and I got a user with: Courses: Angela Carter 'Wise Children', Governement and Politics - A1, As Business Studies Module 1 Marketing Accounting and Finance Last access: Friday, 24 November 2006, 11:20 AM (256 days 10 hours) This CRON thing has not been working for some time!
Hide
Antony O'Sullivan added a comment -

Re: Automatic delete of users fails.
by Antony OSullivan - Sunday, 12 August 2007, 12:35 PM
I have not had time to trace through the data tables yet... but... I put in 4 debug statements in accesslib.php

echo "aaaa 01\n"; ### DEBUG A
if ($select) {
echo "aaaa 02\n"; ### DEBUG B
print_r($select); ### DEBUG C
if ($ras = get_records_select('role_assignments', implode(' AND ', $select))) {
echo "aaaa 03\n"; ### DEBUG D

When I run the cron... I get this sort of output... which never gets to "aaaa 03"

=====================

aaaa 01
aaaa 02
Array
(
[0] => userid = 996
[1] => contextid = 3165
)
Deleted assignment for user 996 from course 322

=====================

aaaa 01
aaaa 02
Array
(
[0] => userid = 204
[1] => contextid = 263
)
Deleted assignment for user 204 from course 218

=====================

In the "mdl_role_assignments" table... for user 996:

There is a line for userid 996:

UserId 996
ContextId: 46 (ie) NOT 3165

=====================

In the "mdl_role_assignments" table... for user 204:

There is a line for userid 204:

UserId 204
ContextId: 271 (ie) NOT 263

=====================

It looks like some kind of problem with mismatched IDs...

Show
Antony O'Sullivan added a comment - Re: Automatic delete of users fails. by Antony OSullivan - Sunday, 12 August 2007, 12:35 PM I have not had time to trace through the data tables yet... but... I put in 4 debug statements in accesslib.php echo "aaaa 01\n"; ### DEBUG A if ($select) { echo "aaaa 02\n"; ### DEBUG B print_r($select); ### DEBUG C if ($ras = get_records_select('role_assignments', implode(' AND ', $select))) { echo "aaaa 03\n"; ### DEBUG D When I run the cron... I get this sort of output... which never gets to "aaaa 03" ===================== aaaa 01 aaaa 02 Array ( [0] => userid = 996 [1] => contextid = 3165 ) Deleted assignment for user 996 from course 322 ===================== aaaa 01 aaaa 02 Array ( [0] => userid = 204 [1] => contextid = 263 ) Deleted assignment for user 204 from course 218 ===================== In the "mdl_role_assignments" table... for user 996: There is a line for userid 996: UserId 996 ContextId: 46 (ie) NOT 3165 ===================== In the "mdl_role_assignments" table... for user 204: There is a line for userid 204: UserId 204 ContextId: 271 (ie) NOT 263 ===================== It looks like some kind of problem with mismatched IDs...
Hide
Sean McKay added a comment -

I'm having simliar issues. Not every time, but every couple of times that cron runs, it attempts to process the same list of users over, and over, and over. Here's an example:

Running clean-up tasks...
Deleted assignment for user 4 from course 258
Deleted assignment for user 45 from course 54
Deleted assignment for user 10 from course 489
Deleted assignment for user 3 from course 277
Deleted assignment for user 26 from course 45
Deleted assignment for user 2354 from course 844
Deleted assignment for user 24 from course 30
Deleted assignment for user 30 from course 463
Deleted assignment for user 31 from course 576
Deleted assignment for user 32 from course 52
Deleted assignment for user 23 from course 37
Deleted assignment for user 35 from course 40
Deleted assignment for user 6 from course 999
Deleted assignment for user 46 from course 55
Deleted assignment for user 17 from course 147
Deleted assignment for user 67 from course 991
Deleted assignment for user 66 from course 70

I've received the same list many times in the last 24 hours that cron has been running.

Show
Sean McKay added a comment - I'm having simliar issues. Not every time, but every couple of times that cron runs, it attempts to process the same list of users over, and over, and over. Here's an example: Running clean-up tasks... Deleted assignment for user 4 from course 258 Deleted assignment for user 45 from course 54 Deleted assignment for user 10 from course 489 Deleted assignment for user 3 from course 277 Deleted assignment for user 26 from course 45 Deleted assignment for user 2354 from course 844 Deleted assignment for user 24 from course 30 Deleted assignment for user 30 from course 463 Deleted assignment for user 31 from course 576 Deleted assignment for user 32 from course 52 Deleted assignment for user 23 from course 37 Deleted assignment for user 35 from course 40 Deleted assignment for user 6 from course 999 Deleted assignment for user 46 from course 55 Deleted assignment for user 17 from course 147 Deleted assignment for user 67 from course 991 Deleted assignment for user 66 from course 70 I've received the same list many times in the last 24 hours that cron has been running.
Hide
Antony O'Sullivan added a comment -

>>
>> Not every time, but every couple of times that cron runs...
>>

This means that you have the same problem as us...

The reason why you do not see the error all of the time... is because... every time cron runs... it does a random number calculation to decide to run the Delete or not on that run... a clever idea to make sure it is not doing lengthy processes every time it runs.

So basically your system is not deleting roles...

Show
Antony O'Sullivan added a comment - >> >> Not every time, but every couple of times that cron runs... >> This means that you have the same problem as us... The reason why you do not see the error all of the time... is because... every time cron runs... it does a random number calculation to decide to run the Delete or not on that run... a clever idea to make sure it is not doing lengthy processes every time it runs. So basically your system is not deleting roles...
Hide
Sean McKay added a comment -

Antony, how do we determine which roles are not being deleted? I've just upgraded to 1.8.2 from 1.6.1. The only customization of roles that we have performed is to allow Editing Teachers to assign the role of Editing Teacher to other teachers in their course.

Show
Sean McKay added a comment - Antony, how do we determine which roles are not being deleted? I've just upgraded to 1.8.2 from 1.6.1. The only customization of roles that we have performed is to allow Editing Teachers to assign the role of Editing Teacher to other teachers in their course.
Hide
Antony O'Sullivan added a comment -

It is more that the system is trying to delete entries with ContextIds that do not exist... read the message before your first message.

Show
Antony O'Sullivan added a comment - It is more that the system is trying to delete entries with ContextIds that do not exist... read the message before your first message.
Hide
Sean McKay added a comment - - edited

Gotcha – so what's the plan for solving the problem? Has this already been addressed in 1.8.2+? If it was, I'd imagine this ticket would be closed already...

Show
Sean McKay added a comment - - edited Gotcha – so what's the plan for solving the problem? Has this already been addressed in 1.8.2+? If it was, I'd imagine this ticket would be closed already...
Hide
Antony O'Sullivan added a comment -

The problem is still not fixed... I still got "entries with ContextIds that do not exist"...

I assume that it is today with data that has got unhooked by mistake in the past....

Show
Antony O'Sullivan added a comment - The problem is still not fixed... I still got "entries with ContextIds that do not exist"... I assume that it is today with data that has got unhooked by mistake in the past....
Hide
Manuel de la Torre added a comment -

I am running Moodle 1.7.2+ and having the same issue!

Show
Manuel de la Torre added a comment - I am running Moodle 1.7.2+ and having the same issue!
Hide
Mike Wilson added a comment -

Are there any new developments on this issue? I'm having exactly the same problem as described. Running 1.8.2

Show
Mike Wilson added a comment - Are there any new developments on this issue? I'm having exactly the same problem as described. Running 1.8.2

People

Vote (4)
Watch (3)

Dates

  • Created:
    Updated: