Coderunner Fails on Moodle 5.2.1

Coderunner Fails on Moodle 5.2.1

by Bruce Nelson -
Number of replies: 3

I need some help because I made a terrible mistake. I tested CodeRunner on Moodle 5.2.1, and it seemed to work. However, I now think it may have been running from cache or using a previously run question because I had cloned the Moodle server, so the cloned server already had some previously executed questions.

I have since encountered some errors, which I pulled from the Nginx server logs.

I tried putting the errors into AI for troubleshooting, but I got different possible issues suggested.

One of the issues suggested was that PHP 8.3 was catching an error in the sandbox.php file.



And the other was that the CodeRunner installation is internally inconsistent.

The parent class in:

classes/sandbox.php

expects a newer execute() signature, while:

classes/ideonesandbox.php

still has the older signature

The Moodle server is already in use so i cannot revert to the old server, I need to solve this issue, some one please help me.
Please check the logs from:
 tail -f /var/log/nginx/error.log

In reply to Bruce Nelson

Re: Coderunner Fails on Moodle 5.2.1

by Richard Lobb -
Hi Bruce. I'm running CodeRunner on Moodle 5.2 on my development system and there shouldn't be any major problems.

There does seem to be an error in ideonesandbox.php, which has probably been there for some time. But the ideonsandbox is defunct and hasn't been used or tested in years. I think you might have inadvertently clicked the "Enable ideonesandbox" checkbox in the CodeRunner admin settings. Could you uncheck that, clear all caches, and see what errors remain, please?
In reply to Richard Lobb

Re: Coderunner Fails on Moodle 5.2.1

by Bruce Nelson -
You were right—the "Enable ideonesandbox" checkbox was checked. I unchecked it, but when I tried to create a new CodeRunner question, I got the error below.

From the error message, it looks like the BUILT_IN_PROTOTYPE questions have been duplicated, i don't know how that happened. What is the best way to remove the duplicates and resolve this issue?

Error:
Reverted to question type: 'Undefined' Could not load question type 'python3' as the prototype is non-unique in the following questions:Question ID: 3139 Name: BUILT_IN_PROTOTYPE_python3Category: CR_PROTOTYPESQuestion ID: 32597 Name: BUILT_IN_PROTOTYPE_python3Category: CR_PROTOTYPES

In reply to Bruce Nelson

Re: Coderunner Fails on Moodle 5.2.1

by Richard Lobb -

It would be nice to know exactly what happened here. A couple of other users have reported duplicate built-in prototypes, but I've never seen it happen myself. I think it can only happen during broken Moodle upgrades or installs, particularly if there are issues with the ad hoc task queue processing (e.g. CRON not running).

Did you perform multiple upgrades on the server? Any info you can provide would be helpful.

But to fix the problem proceed as follows.

Firstly you need to find out where the duplicated prototypes are. Logged in as an administrator, click the Home link at the top of the page, then the Question banks link. You should be looking at something like:

image.png

There should be a system shared question bank and the CodeRunner prototypes should be in that. The timestamps on the questions might be useful in diagnosing what happened.

In this case, you can safely manually delete one copy of each prototype. They're identified by name, so it doesn't matter which one you delete.

If you're seeing two system shared question banks, each containing CodeRunner prototypes, delete the prototypes from one of them (either one) and if there are no questions remaining in it, delete the bank itself.

Either way, please report which situation occurred and any other info that might help diagnose what happened.