Serious Gradebook Problem

Serious Gradebook Problem

by Charlie Daly -
Number of replies: 9

Hello I am running a server using moodle 3.2 on Ubuntu server 16.04. I have two active courses on the site and it has been running reliably for about a year.

Today the gradebook stopped working on a course  and when I turned on debugging to the page , it started spewing out errors that went on and on until I killed the page.


I teach a course in computer programming and I used the vpl plugin to manage programming assignments and had a number (maybe about 20) short programming assignments each week. In addition, I used an attendance plugin to manage student attendance at the labs.

I had quite a complex gradebook setup. The main course was divided into weeks and each week had between two and four sub categories and each of those subcategories had a number of programming assignments. There was a formula that produced a total for the week that depended on the attendance.

Naturally, the most important thing for me is to get the grades working again and I would appreciate any troubleshooting tips. I have full access to the server but am not sure where to start.

Thanks in advance etc.

There follows the first few lines from the error output. As I said it goes on and on:


Warning: Creating default object from empty value in /var/www/html/moodle/lib/grade/grade_category.php on line 2097

Notice: Undefined property: stdClass::$children in /var/www/html/moodle/lib/grade/grade_category.php on line 2115

Warning: array_key_exists() expects parameter 2 to be array, null given in /var/www/html/moodle/lib/grade/grade_category.php on line 2115

Notice: Undefined property: stdClass::$path in /var/www/html/moodle/lib/grade/grade_category.php on line 2131

Notice: Undefined property: stdClass::$id in /var/www/html/moodle/lib/grade/grade_category.php on line 2131

Notice: Undefined property: stdClass::$id in /var/www/html/moodle/lib/grade/grade_category.php on line 2133

Attempt to obtain a grade_category's associated grade_item without the category's ID being set.
  • line 2246 of /lib/grade/grade_category.php: call to debugging()
  • line 2232 of /lib/grade/grade_category.php: call to grade_category->get_grade_item()
  • line 234 of /lib/grade/grade_category.php: call to grade_category->load_grade_item()
  • line 2135 of /lib/grade/grade_category.php: call to grade_category->update()
  • line 2013 of /lib/grade/grade_category.php: call to grade_category->get_children()
  • line 2258 of /grade/lib.php: call to grade_category::fetch_course_tree()
  • line 56 of /grade/edit/tree/index.php: call to grade_tree->__construct()
Can not regrade non existing category
  • line 418 of /lib/grade/grade_category.php: call to debugging()
  • line 257 of /lib/grade/grade_category.php: call to grade_category->qualifies_for_regrading()
  • line 2135 of /lib/grade/grade_category.php: call to grade_category->update()
  • line 2013 of /lib/grade/grade_category.php: call to grade_category->get_children()
  • line 2258 of /grade/lib.php: call to grade_category::fetch_course_tree()
  • line 56 of /grade/edit/tree/index.php: call to grade_tree->__construct()
Can not update grade object, no id!
  • line 248 of /lib/grade/grade_object.php: call to debugging()
  • line 263 of /lib/grade/grade_category.php: call to grade_object->update()
  • line 2135 of /lib/grade/grade_category.php: call to grade_category->update()
  • line 2013 of /lib/grade/grade_category.php: call to grade_category->get_children()
  • line 2258 of /grade/lib.php: call to grade_category::fetch_course_tree()
  • line 56 of /grade/edit/tree/index.php: call to grade_tree->__construct()

Warning: Creating default object from empty value in /var/www/html/moodle/lib/grade/grade_category.php on line 2097
In reply to Charlie Daly

Re: Serious Gradebook Problem

by Charlie Daly -

Part of the error output looks like:

  • line 2136 of /lib/grade/grade_category.php: call to grade_category->get_children()
  • line 2136 of /lib/grade/grade_category.php: call to grade_category->get_children()
  • line 2136 of /lib/grade/grade_category.php: call to grade_category->get_children()
  • line 2136 of /lib/grade/grade_category.php: call to grade_category->get_children()
  • line 2136 of /lib/grade/grade_category.php: call to grade_category->get_children()
  • line 2136 of /lib/grade/grade_category.php: call to grade_category->get_children()
  • line 2136 of /lib/grade/grade_category.php: call to grade_category->get_children()
  • line 2136 of /lib/grade/grade_category.php: call to grade_category->get_children()
  • line 2136 of /lib/grade/grade_category.php: call to grade_category->get_children()
  • line 2136 of /lib/grade/grade_category.php: call to grade_category->get_children()
  • line 2136 of /lib/grade/grade_category.php: call to grade_category->get_children()
  • line 2136 of /lib/grade/grade_category.php: call to grade_category->get_children()
  • line 2136 of /lib/grade/grade_category.php: call to grade_category->get_children()
  • line 2136 of /lib/grade/grade_category.php: call to grade_category->get_children()
  • line 2136 of /lib/grade/grade_category.php: call to grade_category->get_children()
  • line 2136 of /lib/grade/grade_category.php: call to grade_category->get_children()
  • line 2136 of /lib/grade/grade_category.php: call to grade_category->get_children()
  • line 2136 of /lib/grade/grade_category.php: call to grade_category->get_children()
  • line 2136 of /lib/grade/grade_category.php: call to grade_category->get_children()
  • line 2136 of /lib/grade/grade_category.php: call to grade_category->get_children()
  • line 2136 of /lib/grade/grade_category.php: call to grade_category->get_children()
  • line 2136 of /lib/grade/grade_category.php: call to grade_category->get_children()
  • line 2136 of /lib/grade/grade_category.php: call to grade_category->get_children()
  • line 2136 of /lib/grade/grade_category.php: call to grade_category->get_children()
and then continue with


  • line 2013 of /lib/grade/grade_category.php: call to grade_category->get_children()
  • line 2258 of /grade/lib.php: call to grade_category::fetch_course_tree()
  • line 56 of /grade/edit/tree/index.php: call to grade_tree->__construct()
Can not update grade object, no id!
  • line 248 of /lib/grade/grade_object.php: call to debugging()
  • line 263 of /lib/grade/grade_category.php: call to grade_object->update()
  • line 2135 of /lib/grade/grade_category.php: call to grade_category->update()
  • line 2136 of /lib/grade/grade_category.php: call to grade_category->get_children()
  • line 2136 of /lib/grade/grade_category.php: call to grade_category->get_children()
  • line 2136 of /lib/grade/grade_category.php: call to grade_category->get_children()
etc.


It finally finishes after many lines with the following:

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 86016 bytes) in /var/www/html/moodle/lib/dml/mysqli_native_moodle_database.php on line 1093

There are 121521 lines in the output altogether.

In reply to Charlie Daly

Re: Serious Gradebook Problem

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

Well the first question would be, what did you do just before the gradebook broke?  Did you perhaps delete an assignment that is referenced in a grade calculation for example?

In reply to Emma Richardson

Re: Serious Gradebook Problem

by Charlie Daly -

What I did just before it broke was to delete an unused category in the gradebook. I was asked to confirm and did so and then everything broke. So, I guess that cannot be retrieved.

I had tried to move the category before that, and it simply refused to be moved so there had been something wrong with that category anyway (which was the main reason I decided to remove it).

In reply to Charlie Daly

Re: Serious Gradebook Problem

by Charlie Daly -

Update:

The course is currently unusable. I have tried making a backup of the course in the hope that restoring it would fix the problem. However, the restore stopped when 99.82% complete.

The Apache error logs created today are over a gigbyte in size.

In reply to Charlie Daly

Re: Serious Gradebook Problem

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

And you do not have a backup from prior to the category deletion?

Again, I would guess that the category is somehow referenced in one of your custom calculations?  Have you checked your calculations and removed any reference to it?

In reply to Emma Richardson

Re: Serious Gradebook Problem

by Charlie Daly -


Unfortunately, I can't go into the gradebook now because of this error so I can't delete any references.

I have a backup from the morning of the crash but there was a lab where students would have done many exercises. I was hoping not to lose that data.

One ignorant way of fixing the situation might be to export the gradebook setup of the working backup and restore it onto the broken version.

I just hoped that someone might have a workaround.

Thanks for your suggestions.


In reply to Charlie Daly

Re: Serious Gradebook Problem

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

You could probably get into the database and edit the calculations there.  That is the only way I can think of.  

If you do not have access to the database, at this point, I think you have to be happy with restoring the course and not losing the whole thing.

I guess you might be able to restore the course from before the crash, edit the calculations, and then try restoring the user data into it from a later backup...worth a try.

In reply to Emma Richardson

Re: Serious Gradebook Problem

by Charlie Daly -

OK, thank you for your help.

In reply to Charlie Daly

Re: Serious Gradebook Problem

by Charlie Daly -

OK, I finally got it to work.


I downloaded the backup into a VM and used mysqldump to save the database. I deleted the gradebook category entry. And again saved the database. I used a diff program to spot the changes between the two databases and it seemed as if only one relevant table was affected, namely mdl_grade_categories.

So, I backed that up, then copied that table from the backup to the broken version and after some foostering, it all seems to work.