Cannot delete test from Moodle course

Cannot delete test from Moodle course

by Brad Johnson -
Number of replies: 12

We are experiencing an issue in a Moodle course where a user will try to delete a test, but cannot. Here's a walk-through of what happens:

  1. Open the course having the issue (this issue is only happening with one course, not any others).
  2. Turn editing on.
  3. Pick any test, click "Edit", and pick delete. Click "Yes" in the confirmation box that comes up. 
  4. Turn editing off. 
  5. The page will load for a very long time, and eventually time out with an error box that almost immediately disappears. Sometimes this box is empty, sometimes it says "unknown error".
  6. We've tried enabling errors as described in Debugging - MoodleDocs and repeating the above steps, but that still does not display any errors at all. Not in on the web page, nor an error_log file. 

I'm not even sure where to begin troubleshooting this if I can't get it to throw any errors. 

I'm running Moodle 3.1.3+ (Build: 20161202).

Average of ratings: -
In reply to Brad Johnson

Re: Cannot delete test from Moodle course

by Helen Foster -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

Hi Brad,

By 'test', do you mean a Moodle quiz activity?

In reply to Helen Foster

Re: Cannot delete test from Moodle course

by Brad Johnson -
That must be what I mean! Sorry, not familiar with all the Moodle terminology! 
In reply to Brad Johnson

Re: Cannot delete quiz from Moodle course

by Helen Foster -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

OK, I'm going to move your discussion thread to the Quiz forum, where hopefully someone can help...

In reply to Brad Johnson

Re: Cannot delete test from Moodle course

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

When enabled debugging, did you select full developer mode?  If not, try that and try again.

Can you delete other activities in the course?

Are these quizzes larger (more questions) that quizzes in other courses?  Do they use questions from a shared question bank or questions that are just specific to the course in question?

Is this specific to the teacher or do admins experience the same behavior?

In reply to Emma Richardson

Re: Cannot delete test from Moodle course

by Brad Johnson -

> When enabled debugging, did you select full developer mode?  If not, try that and try again.

I did, and the only errors that were reported in "course/error_log" didn't seem to have anything to do with the problem: http://pastebin.com/VqyYhGfC

To clarify, I only got these errors to appear with full developer mode.

> Can you delete other activities in the course?

No

> Are these quizzes larger (more questions) that quizzes in other courses?  Do they use questions from a shared question bank or questions that are just specific to the course in question?

They're roughly the same size as all the rest. I don't believe any of the questions come from a shared question bank, but I'll dig deeper into it and confirm. 

> Is this specific to the teacher or do admins experience the same behavior?

I log in with the admin user account and experience the same issue as the teacher, who doesn't. 

In reply to Brad Johnson

Re: Cannot delete test from Moodle course

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

That is not the error log we are looking for.  Try outputting to screen briefly and see what shows up when you try and delete something.

If this is happening with all activity types in just this course, then I would suggest backing up and restoring the course to see if that resolves it.

In reply to Emma Richardson

Re: Cannot delete test from Moodle course

by Brad Johnson -

I can not get errors to write to the page. I tried enabling both the developer errors (in the Moodle UI) and PHP errors (in the config.php file). Neither would write errors to the page. 

How would I back up then restore just the course? Does Moodle have some kind of backup function? 

In reply to Brad Johnson

Re: Cannot delete test from Moodle course

by Rob Woof -

I have been getting an almost identical issue, but only when deleting quizzes. Resources delete without complaint. It gets weird, though, in terms of the Moodle in which it appears.

The Production Moodle (Windows Server 2012R2 running IIS, MySQL 5.6.29, PHP 5.4.33 and Moodle 3.1.2+) has no problems.

Dev Moodle 1, which was a clone of the production Moodle, first saw the error. The clone was created by copying the moodledata directory to the Dev server (Windows Server 2012R2, IIS, MySQL 5.6.21, PHP 5.4.33, Moodle 3.1.5+) and using a MySQL Dump from the Production server with the Dev server's URL inserted by text substitution before import into the database.

This migration was done twice, with the error occurring every time we tried to delete a Quiz in the Dev version.

Dev Moodle 2 was then tried, where instead of a clone with URL substitution we created a new Moodle 3.1.5+ (CentOS 6.4 Linux, Apache 2, MySQL 5.6.34, PHP 5.4.45) and restored the courses 1 by 1 from backups from Production. During the Restore process we excluded Student data.

In this Dev Moodle, the error still occurs every time we try to delete a Quiz.

Additional detail: when the error triggers on the Linux server, the mysqld process starts consuming 99% of the processor resources. Nothing happens int he browser except the "loading" circle going around and around. If I give up and use the Linux command line to restart mysqld, the server becomes responsive again, but the Quiz reappears on the Course page.

Suggestions?

Questions?

In reply to Rob Woof

Re: Cannot delete test from Moodle course

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

Turn on debugging and tell us the message...try clearing your cache - maybe it did delete but you are just seeing an old page..

In reply to Emma Richardson

Re: Cannot delete test from Moodle course

by Rob Woof -

Thanks for replying, Emma. I gave that a shot.

With debugging on, I still got the "Unknown error" dialogue, and click OK on it sent the browser tab into the "loading but nothing's happening state. I left it for about half an hour while I was doing something else. When I checked again, the tab showed:

Table "sessions" does not exist
Debug info:
Error code: ddltablenotexist
Stack trace:
  • line 645 of /lib/dml/moodle_database.php: dml_exception thrown
  • line 1501 of /lib/dml/moodle_database.php: call to moodle_database->where_clause()
  • line 286 of /lib/classes/session/manager.php: call to moodle_database->get_record()
  • line 82 of /lib/classes/session/manager.php: call to core\session\manager::initialise_user_session()
  • line 782 of /lib/setup.php: call to core\session\manager::start()
  • line 331 of /config.php: call to include_once()
  • line 5 of /course/view.php: call to require_once()

The PHP error log contained the following:

[05-Apr-2017 14:04:43 Australia/Sydney] PHP Warning:  include(/websites/learningrob.moore.edu.au/root/theme/moore_var/version.php): failed to open stream: No such file or directory in /websites/learningrob.moore.edu.au/root/lib/classes/component.php on line 1159
[05-Apr-2017 14:04:43 Australia/Sydney] PHP Warning:  include(): Failed opening '/websites/learningrob.moore.edu.au/root/theme/moore_var/version.php' for inclusion (include_path='/websites/learningrob.moore.edu.au/root/lib/pear:.:/usr/share/pear:/usr/share/php') in /websites/learningrob.moore.edu.au/root/lib/classes/component.php on line 1159
[05-Apr-2017 14:05:09 Australia/Sydney] instantiating backup controller d722fb4d90d9802301db2bfccff06687
[05-Apr-2017 14:05:09 Australia/Sydney] setting controller status to 100
[05-Apr-2017 14:05:09 Australia/Sydney] loading controller plan
[05-Apr-2017 14:05:09 Australia/Sydney] setting controller status to 300
[05-Apr-2017 14:05:09 Australia/Sydney] applying plan defaults
[05-Apr-2017 14:05:09 Australia/Sydney] setting controller status to 400
[05-Apr-2017 14:05:09 Australia/Sydney] setting file inclusion to 1
[05-Apr-2017 14:05:09 Australia/Sydney] checking plan security
[05-Apr-2017 14:05:09 Australia/Sydney] setting controller status to 700
[05-Apr-2017 14:05:09 Australia/Sydney] saving controller to db
[05-Apr-2017 14:05:09 Australia/Sydney] calculating controller checksum a4d746b76dfe808516f1d19b028f5a41
[05-Apr-2017 14:05:09 Australia/Sydney] loading controller from db
[05-Apr-2017 14:05:09 Australia/Sydney] notifying plan about excluded activities by type
[05-Apr-2017 14:05:09 Australia/Sydney] setting controller status to 800
[05-Apr-2017 14:39:50 Australia/Sydney] setting controller status to 1000
[05-Apr-2017 14:39:50 Australia/Sydney] saving controller to db
[05-Apr-2017 14:39:51 Australia/Sydney] Default exception handler: Table "sessions" does not exist Debug:
Error code: ddltablenotexist
* line 645 of /lib/dml/moodle_database.php: dml_exception thrown
* line 1501 of /lib/dml/moodle_database.php: call to moodle_database->where_clause()
* line 286 of /lib/classes/session/manager.php: call to moodle_database->get_record()
* line 82 of /lib/classes/session/manager.php: call to core\session\manager::initialise_user_session()
* line 782 of /lib/setup.php: call to core\session\manager::start()
* line 331 of /config.php: call to include_once()
* line 5 of /course/view.php: call to require_once()

[05-Apr-2017 15:05:15 Australia/Sydney] PHP Notice:  Undefined property: stdClass::$firstname in /websites/learningrob.moore.edu.au/root/theme/moore_ole/layout/general.php on line 85
[05-Apr-2017 15:05:15 Australia/Sydney] PHP Notice:  Undefined property: stdClass::$lastname in /websites/learningrob.moore.edu.au/root/theme/moore_ole/layout/general.php on line 85
[05-Apr-2017 15:05:15 Australia/Sydney] PHP Notice:  Undefined property: stdClass::$username in /websites/learningrob.moore.edu.au/root/theme/moore_ole/layout/general.php on line 85
[05-Apr-2017 15:05:18 Australia/Sydney] [client 10.10.9.87]  https://learningrob.moore.edu.au  Failed Login:  rgw  Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:52.0) Gecko/20100101 Firefox/52.0
[05-Apr-2017 15:05:18 Australia/Sydney] PHP Notice:  Undefined property: stdClass::$firstname in /websites/learningrob.moore.edu.au/root/theme/moore_ole/layout/general.php on line 85
[05-Apr-2017 15:05:18 Australia/Sydney] PHP Notice:  Undefined property: stdClass::$lastname in /websites/learningrob.moore.edu.au/root/theme/moore_ole/layout/general.php on line 85
[05-Apr-2017 15:05:18 Australia/Sydney] PHP Notice:  Undefined property: stdClass::$username in /websites/learningrob.moore.edu.au/root/theme/moore_ole/layout/general.php on line 85

I then typed in the root URL of the site and was required to log in again. WHen I went to the relevant Course page, the Quiz I had deleted was gone.

Other notes: again, after clicking OK on the "Unknown error" dialogue, mysqld on the server went to 99% of the processor. Once I logged in again, mysqld had stopped its processor hogging.

Thanks.
In reply to Rob Woof

Re: Cannot delete test from Moodle course

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

It appears you might have an issue with the database but glad to see that it did at least delete.  Is it possible that this quiz was using an additional question type that is no longer available?  I would see if you add a quiz to this course, can you then delete it normally?  If that works correctly, I would probably right it off as something corrupted with just that quiz..