CodeRunner not working with Moodle 4.0

CodeRunner not working with Moodle 4.0

por MohammedAzim Shaikh -
Número de respuestas: 6

Hi All,

I just setup Jobe Server in a ubuntu 16 OS server and connected in a LAN.

CodeRunner not working with Moodle 4.0.


The same configuration has been set to Moodle 3.11, it works properly.

I deployed coderunner qtype from the development branch from Github. 

Can anyone please help how to track the issue?

En respuesta a MohammedAzim Shaikh

Re: CodeRunner not working with Moodle 4.0

por Richard Lobb -
This arises when CodeRunner can't access the Jobe server. Do you get the same error if you use the default University of Canterbury Jobe server?

There have been a couple of reports of Moodle 4.0 being unable to access the Jobe server because of tightened HTTP security. Is your Jobe server installed on the same server as Moodle, say with a JobeInTheBox docker image? If so, the Moodle 4.0 settings are probably blocking it. Check Site administration > HTTP security > cURL blocked host list. The default settings are to block all the following hosts:

127.0.0.1
192.168.0.0/16
10.0.0.0/8
172.16.0.0/12
0.0.0.0
localhost
169.254.169.254
0000::1
En respuesta a Richard Lobb

Re: CodeRunner not working with Moodle 4.0

por MohammedAzim Shaikh -
[1] I get the same error while using the default University of Canterbury Jobe server.
[2] I'm not using JobeInTheBox docker image.
[3] I've cleared the administration > HTTP security > cURL blocked host list.
Still same error.
En respuesta a MohammedAzim Shaikh

Re: CodeRunner not working with Moodle 4.0

por Richard Lobb -

I you save the attached simpletest.py file onto your Moodle server and run it as root with the command

python3 simpletest.py

what happens?

En respuesta a Richard Lobb

Re: CodeRunner not working with Moodle 4.0

por MohammedAzim Shaikh -
Received proper output
============================================

Microsoft Windows [Version 10.0.19044.2006]
(c) Microsoft Corporation. All rights reserved.

C:\Users\admin\Desktop>python3 simpletest.py
Supported languages:
c: 9.4.0
cpp: 9.4.0
java: 14.0.2
nodejs: 10.19.0
octave: 5.2.0
pascal: 3.0.4
php: 7.4.3
python3: 3.9.1

Running python...
Successful run

Output:
Message is Hello Jobe!



Running C++
Successful run

Output:
Hello Jobe!



Running Java
Successful run

Output:
Farewell cruel world
En respuesta a MohammedAzim Shaikh

Re: CodeRunner not working with Moodle 4.0

por MohammedAzim Shaikh -
Also I made a duplicate file by changing JOBE_SERVER = '192.168.XXX.YYY' to my Jobe Server's LAN IP. I also get the same output as follow.
========================================

C:\Users\admin\Desktop>python3 simpletest2.py
Supported languages:
c: 9.4.0
cpp: 9.4.0
java: 11.0.16
nodejs: 10.19.0
pascal: 3.0.4
php: 7.4.3
python3: 3.8.10

Running python...
Successful run

Output:
Message is Hello Jobe!



Running C++
Successful run

Output:
Hello Jobe!



Running Java
Successful run

Output:
Farewell cruel world
En respuesta a MohammedAzim Shaikh

Re: CodeRunner not working with Moodle 4.0

por Richard Lobb -
The problem was resolved in subsequent private correspondence. MohammedAzim Shaikh reports:

I tried removing all the ‘cURL blocked host list’ and found the issue was solved. My Jobe server IP is ‘192.168.xxx.yyy’, and the cURL blocked host ‘192.168.0.0/16’ was blocking the connection. I removed that particular entry and ran the code runner and finally it worked.

For the benefit of other readers with similar problems, the cURL block host configuration is at Site administration > HTTP security > cURL blocked host list. The default is specified to block various common internal network or cloud provider hosts. There's a potential confusion here if the field on that page is left blank: does that mean the default values are used, or does it mean no hosts are blocked? I suggest when testing that you try copying the default values into the textarea, but delete any that might be problematic.