-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add timeout and better error message to quiz submit request #1185
Add timeout and better error message to quiz submit request #1185
Conversation
95d4e31
to
c12e7fa
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch with the jQuery.ajax timeout. I was surprised to see that there are still submission errors that are hard to read inside the alert progress bar. Could you still double-check this? I wrote a message in the normal conversation chain (outside this review).
I moved the error message from the progress bar to a separate alert box now. |
fe697fe
to
a7f50ad
Compare
In the submit modal dialog in chapters, the error message was displayed inside a progress bar. That was not a good idea since it was hard to read and the latter half of the message disappeared since it did not fit into the progress bar. The error message is now moved to a separate alert box above the progress bar.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, I will rebase and merge this now!
There are multiple, a little different error messages for the grading connection errors in the code base. Some of them could be maybe removed and replaced with the almost identical ones. It is not immediately obvious why there are multiple similar strings (in django.po). Some of them are used in similar situations (based on a quick glance), some in a clearly different scenario. Since most of them are old, we should check if they are really up-to-date. Some of them promise that the course staff is emailed about the errors, but I am not sure if the email is really sent in all cases.
Similar strings include:
- SUBMISSION_ERROR_ALERT_COMMUNICATION_ERROR_W_SERVICE
- EXERCISE_ERROR_COMMUNICATION
- EXERCISE_SERVICE_ERROR_CONNECTION_FAILED
- ASSESSMENT_SERVICE_ERROR_CONNECTION_FAILED
- ERROR_ALERT_EXERCISE_ASSESSMENT_SERVICE_MALFUNCTIONING
stripped_content = response.content.decode("utf-8").replace("modal-submit-error alert alert-danger", "") | ||
self.assertNotIn("alert alert-danger", stripped_content) | ||
self.assertIn("alert alert-success", stripped_content) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks a bit strange. What is the idea here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
base.html
now includes a hidden div
with class="modal-submit-error alert alert-danger"
.
It has to be stripped away before asserting in the course cloning tests so that the tests don't fail, because they think course cloning failed and rendered a different alert.
@@ -3962,9 +3962,10 @@ msgstr "Posting submission..." | |||
#: exercise/templates/exercise/_submit_progress.html | |||
msgid "SUBMISSION_ERROR_ALERT_COMMUNICATION_ERROR_W_SERVICE" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After the latest changes, when is this string really used? I could see EXERCISE_ERROR_COMMUNICATION
during short testing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is shown, for example, when submitting a questionnaire fails because grader can't be reached.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I was testing with a programming assignment and I could only see EXERCISE_ERROR_COMMUNICATION
then.
@@ -460,7 +460,8 @@ | |||
data: formData, | |||
contentType: false, | |||
processData: false, | |||
dataType: "html" | |||
dataType: "html", | |||
timeout: 10000, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could increase the timeout to 20 seconds. 10 seconds is not enough if there are issues with connecting to the grader. A+ retries the connection to the grader three times by default. 10 seconds is not enough for A+ to finish those three connection attempts to the grader.
A+ shows the error message EXERCISE_SERVICE_ERROR_CONNECTION_FAILED
after it has failed to connect to the grader. The 10-second timeout in the JavaScript hides that error.
a-plus/exercise/protocol/aplus.py
Line 36 in c76e3fb
_('EXERCISE_SERVICE_ERROR_CONNECTION_FAILED')) |
Lines 60 to 62 in c76e3fb
last_retry = len(settings.EXERCISE_HTTP_RETRIES) - 1 | |
n = 0 | |
while n <= last_retry: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently, the error SUBMISSION_ERROR_ALERT_COMMUNICATION_ERROR_W_SERVICE
is shown when the timeout occurs, e.g., when submitting a questionnaire fails due to grader being unavailable.
If the timeout is increased, which message will show? Do we want both to show?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So A+ now actually shows different errors for questionnaires and asynchronous assignments when the timeout triggers. With the 10-second timeout, I would only see EXERCISE_ERROR_COMMUNICATION
in a programming assignment. With 20-second time, the A+ backend has time to trigger EXERCISE_SERVICE_ERROR_CONNECTION_FAILED
.
I already made a new commit that changes the chapter.js timeout to 20 seconds. There is still room to improve the error messages and remove unnecessary overlaps.
a7f50ad
to
339be66
Compare
One issue related to the emails that maybe were not sent to the course staff even though the error message promised so: |
Timeout was added to the AJAX submissions in chapter.js in the pull request apluslms#1185. However, 10 seconds was too short compared to the retry loop when A+ is not able to immediately connect to the grader. Increase the timeout to 20 seconds so that A+ can finish the connection attempts to the grader before chapter.js causes a timeout for the submission attempt. Pull request comment: apluslms#1185 (comment) The retry loop in the code: https://github.com/apluslms/a-plus/blob/88f2dc91667eed12a275427585643b6c787dfa1c/lib/remote_page.py#L60-L62
Description
What?
Previously when the student's internet connection or MOOC-Grader was down, submitting a questionnaire resulted in the error message
Connecting to the assessment service failed!
to be displayed. A more suitable error message had existed, but it was not shown because of a bug.This bug is now fixed by adding a timeout to the submit request (the request's failure handler is now properly called). The existing error message
SUBMISSION_ERROR_ALERT_COMMUNICATION_ERROR_W_SERVICE
was also modified to be more descriptive.If A+ can't be reached, a submission is obviously not consumed by making the submit request. However, a submission is consumed if A+ receives the submit request, even if MOOC-Grader can't be reached. In this case, the submission is put into the
Initialized
state and should be automatically sent to the grading service when it is available.It is not easy to distinguish whether the user's internet connection is down or if the grading service is down, since they both result in a similar timeout in
chapter.js
. This is why we use the same error message for both scenarios.Closes #852
Testing
What type of test did you run?
Tested scenarios where a questionnaire was submitted while A+ or MOOC-Grader wasn't reachable. The error message was displayed properly in both cases.
Did you test the changes in
Translation
Programming style
Have you updated the README or other relevant documentation?
Is it Done?