HTTP Error 500

HTTP Error 500

by Julien Ciaffi -
Number of replies: 5

Hello,

First I want to thank you very much for this plugin. I find it very useful. I used it in june 2020 with my students and it worked perfectly. 

Now, when I try to precheck an attemp in a quiz I get an HTTP Error 500 in my browser. 

HTTP Error 500

And I can see that line in the Server's Apache Error log : 

[Thu Sep 10 11:51:34.071635 2020] [php7:notice] [pid 11269] [client ---------:61307] Potential coding error - active database transaction detected during request shutdown:\n* 
line 1825 of /mod/quiz/attemptlib.php: call to moodle_database->start_delegated_transaction()\n* line 2179 of /mod/quiz/attemptlib.php: call to 
quiz_attempt->process_submitted_actions()\n* line 89 of /mod/quiz/processattempt.php: call to quiz_attempt->process_attempt()\n, 
referer: https://--------------.fr/mod/quiz/attempt.php?attempt=7876&cmid=4467

I updated coderunner plugin to the last version.

I verified Jobe is working fine by running  "python3 testsubmit.py" from the moodle server.

Could you help me fix that problem ? Between June and now I updated server's OS, not Moodle. My Moodle's version is 3.5. I am reluctant to updating it. Do you think it is necessary ?

Thank you very much in advance,

Julien

In reply to Julien Ciaffi

Re: HTTP Error 500

by Richard Lobb -

I haven't seen an error like that before. Are you sure it's CodeRunner related? The error message comes from the quiz module, not from the question engine. Does the error still occur when you preview a CodeRunner question? If so, what about when you preview a multichoice question?

I suggest you try to pin down better the exact circumstances that lead to the error. Perhaps reboot your Moodle server (and the database server if it's on a separate machine), then create a new question, preview it, create a new quiz, add the question to it, preview the quiz, and so on. Find a repeatable sequence of actions that always triggers the error.

In reply to Richard Lobb

Re: HTTP Error 500

by Julien Ciaffi -

Thank you for your answer.

The HTTP Error 500 happens only and for all CodeRunner questions. I tested multichoice and short answer questions, they work fine. 

The error happens each time Python code needs to be processed. 

  • In a quiz, students can display the questions but when they precheck their answer, the Error 500 triggers.
  • I can preview questions but I cannot "Precheck", "Vérifier", "Envoyer et terminer" :

preview

I can create a CodeRunner question, but not with python code in the "response" field. Here is my repeatable sequence :

  1. I go into the questions Bank. 
  2. I ask for a new CodeRunner question. 
  3. I fill the form with basic info. Cf below(*). But no code in the "response" field.
  4. I register the question.
  5. I edit the question to add python code in the "response" field. For example : "print(2)". Cf below (**)
  6. Error 500 happens when I click on "Register".  There is no error log. And this is what I can see in the access.log :
 - - [11/Sep/2020:18:21:18 +0200] "GET /help_ajax.php?component=qtype_coderunner&identifier=answer&lang=fr HTTP/1.1" 200 4863 "https://------------------.fr/question/question.php?returnurl=%2Fquestion%2Fedit.php%3Fcourseid%3D367%26cat%3D698%252C15578&courseid=367&id=33120" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36"
 - - [11/Sep/2020:18:21:39 +0200] "POST /lib/editor/atto/autosave-ajax.php HTTP/1.1" 200 4666 "https://------------------.fr/question/question.php?returnurl=%2Fquestion%2Fedit.php%3Fcourseid%3D367%26cat%3D698%252C15578&courseid=367&id=33120" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36"
 - - [11/Sep/2020:18:21:40 +0200] "POST /question/question.php HTTP/1.1" 500 317 "https://------------.fr/question/question.php?returnurl=%2Fquestion%2Fedit.php%3Fcourseid%3D367%26cat%3D698%252C15578&courseid=367&id=33120" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36"

(*)

create question

(**)

add python code

Thank you again for your help.

In reply to Richard Lobb

Re: HTTP Error 500

by Julien Ciaffi -

(I also rebooted the Moodle+database server.)

In reply to Julien Ciaffi

Re: HTTP Error 500

by Richard Lobb -

Many thanks for the thorough report. That helps a lot. Certainly it now seems clear that the problem is CodeRunner-related.

You say "Error 500 happens when I click on "Register".  There is no error log." We need to know what that 500 error is, and the fact there's nothing in the error log suggests that your site debugging level is set too low to see the error. If you log in as a Moodle administrator and go to Site administration > Development > Debugging, what is "Debug messages" set to? I'm guessing it's None. If so, please change it to Developer  and preview a CodeRunner question to see if you now get helpful error messages on screen and/or in the Apache error log. [You might want to back off the debugging level to at least Normal when you've done that, if this is a production server.]

In reply to Richard Lobb

Re: HTTP Error 500

by Julien Ciaffi -

Problem solved !

I went to Site administration > Development > Debugging, and set "Debug messages" to "Developer". It was configured at "normal".

I had now details in the apache error log :

[Sat Sep 12 04:39:49.662733 2020] [php7:error] [pid 2151] [client ----------:49774] PHP Fatal error:  cURL module must be enabled! in /var/www/moodle/lib/filelib.php on line 2873, referer: https://------.fr/question/question.php?returnurl=%2Fquestion%2Fedit.php%3Fcmid%3D4467&cmid=4467&id=33120


I fixed php-curl and CodeRunner is now working fine again !

Thank you very much for your help and your great plugin.