-
Bug
-
Resolution: Fixed
-
Major
-
3.11.3, 4.0
-
MOODLE_311_STABLE, MOODLE_400_STABLE
-
MOODLE_311_STABLE
-
MDL-72566-master -
We (seemingly) randomly had the following error :
line 236 of /lib/modinfolib.php: moodle_exception thrown
line 1890 of /lib/modinfolib.php: call to course_modinfo->get_cm()
line 1078 of /lib/completionlib.php: call to cm_info::create()
line 70 of /completion/classes/cm_completion_details.php: call to completion_info->get_data()
line 275 of /completion/classes/cm_completion_details.php: call to core_completion\cm_completion_details->__construct()
line 947 of /course/renderer.php: call to core_completion\cm_completion_details::get_instance()
line 836 of /course/renderer.php: call to core_course_renderer->course_section_cm()
line 1051 of /course/renderer.php: call to core_course_renderer->course_section_cm_list_item()
line 859 of /course/format/renderer.php: call to core_course_renderer->course_section_cm_list()
line 57 of /course/format/topics/format.php: call to format_section_renderer_base->print_multiple_section_page()
line 278 of /course/view.php: call to require()
By checking the offending data in one of the cases, here are some more details :
When code reaches this point $cmid equals 1128369 (mod_zoom), but $this->cms only contains [1128368](mod_forum).
When checking the course_modules DB table for this course, I find the correct two course modules :
> SELECT * FROM mdl_course_modules WHERE course = 21942;
id | course | module | instance | section | idnumber | added | score | indent | visible | visibleoncoursepage | visibleold | groupmode | groupingid | completion | completiongradeitemnumber | completionview | completionexpected | showdescription | availability | deletioninprogress |
1128368 | 21942 | 7 | 38890 | 277352 | NULL | 1599468499 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | NULL | 0 | 0 | 0 | NULL | 0 |
1128369 | 21942 | 48 | 0 | 277352 | 1600084544 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | NULL | 0 | 0 | 0 | NULL | 0 |
Module 7 is mod_forum, whereas module 48 is mod_zoom.
I noticed that this involves some weird "ghost" module instance, having mdl_course_modules.instance = 0 (as per the example query result above).
So far, I've encountered cases involving mod_forum, mod_zoom, mod_scorm, and mod_assign – so it does not look like a bug related to any of these in particular.
Checking further, $this->cms never contains any of these "ghost" modules, and they are never displayed on the course page. Trying to force their display (by browsing to /mod/<modulename>/view.php?id=<cm.instance>) obviously does not work either – it yields the same exception in course_modinfo::get_cm().
I then checked what had changed on our Moodle installation recently, noting that I had just upgraded from Moodle 3.11.2 to 3.11.3 earlier on the same day.
Looking at the changes made in one of the fixed issues (from the [Moodle 3.11.3 release notes|https://docs.moodle.org/dev/Moodle_3.11_release_notes),] I noticed one that was related to improve performance of activity information (and completion) : MDL-71899.
I then just reverted this line, and it seemed to fix the problem :
- caused a regression
-
MDL-72392 Student activity completion in Moodle ≥ 3.11 less tolerant with orphanded course modules
- Closed
- has been marked as being related by
-
CONTRIB-8785 Importing quiz from sharing cart int oa hidden section generates failure under certain circumstances
- Open
- is a regression caused by
-
MDL-71899 Improve 3.11 Activity information performance
- Closed
- is duplicated by
-
MDL-72392 Student activity completion in Moodle ≥ 3.11 less tolerant with orphanded course modules
- Closed
- will help resolve
-
MDLSITE-6563 Invalid course module ID in several courses
- Resolved