trampgeek / moodle-qtype_coderunner

CodeRunner: A moodle quiz question type that runs student-submitted program code in a sandbox to check if it satisfies a given set of tests.
GNU General Public License v2.0
208 stars 121 forks source link

Occasional "plugin failure" messages #58

Closed dirkcgrunwald closed 6 years ago

dirkcgrunwald commented 6 years ago

I'm running version 3.4.0 on a Moodle 3.4.2 install. We're using the REMUI ui. Our docker container was built ~2 weeks ago, so I believe this has all the 3.4.0 commits.

Occasionally, when students access a coderunner question, they get a message that I believe is

amd/src/userinterfacewrapper.js:                alert("Failed to load UI component. If this error persists, please report it to the forum on coderunner.org.nz");

I haven't been able to reproduce this error -- I have experienced it, but can't reliably reproduce it. Happy to help diagnose.

trampgeek commented 6 years ago

Thanks for reporting this Dirk. Certainly I'd like to be able to fix it; thanks for offering to help diagnose. I put that alert in there while developing when I had a race problem in conjunction with slow Ace Editor loads. I left it in just to reassure myself that the problems were all solved. Apparently not :-(

We use Clean, More and Boost themes and I've never seen that Alert come up since I "fixed" the problems. I've never used REMUI and that might be a factor in the problem, though I'm inclined to doubt it.

A few questions, please:

  1. I assume you've set the student answer boxes to the standard Ace editor?
  2. I'm guessing that the Alert only comes up when a student, or more particularly the browser they're using, is accessing CodeRunner for the first since you installed, or updated to, the latest version. Do you have any way of confirming or denying that guess?
  3. Is it the case that the problem goes away when they refresh the page?
  4. Has the same student, using the same browser, ever seen the problem twice?
  5. Have you seen the problem with other Moodle themes, or haven't you tried using other ones?
  6. Can your confirm that all the reported cases relate to an Alert box coming up? I mention this because there's another type of UI Load failure, which I do see reasonably frequently, which occurs when a browser accesses CodeRunner (or, to be precise, the Ace editor) for the first time since Moodle was upgraded. In this version of the load failure, the student sees a normal text box rather than an Ace editor box, but with UI Load Failure written just above it. I understand this issue, but as it's hard to fix and is a one-off problem which goes away as soon as the page is refreshed, I'm just having to live with it for now.
  7. Is it possible that the issues also arise only when quite a few students are accessing the docker Moodle container? I've written the code so that even if a race problem occurs the Alert shouldn't come up provided Ace can be loaded within 4 seconds. I could of course increase that timeout.

Meanwhile, I'll start poring over the code again to see if I can find any potential race problems. I should perhaps mention that JavaScript problems of this sort are normally solved by appropriate use of 'require'. However, the Ace editor doesn't conform to Moodle coding standards (meaning it's not an AMD module), so I have to cheat a bit, and that's where the issue is probably arising.

dirkcgrunwald commented 6 years ago

Actually it is case 6, not an alert. I have seen the error twice after upgrading but don't remember if it was in same browser.

On Sat, Jun 2, 2018, 2:46 AM Richard Lobb notifications@github.com wrote:

Thanks for reporting this Dirk. Certainly I'd like to be able to fix it; thanks for offering to help diagnose. I put that alert in there while developing when I had a race problem in conjunction with slow Ace Editor loads. I left it in just to reassure myself that the problems were all solved. Apparently not :-(

We use Clean, More and Boost themes and I've never seen that Alert come up since I "fixed" the problems. I've never used REMUI and that might be a factor in the problem, though I'm inclined to doubt it.

A few questions, please:

  1. I assume you've set the student answer boxes to the standard Ace editor?
  2. I'm guessing that the Alert only comes up when a student, or more particularly the browser they're using, is accessing CodeRunner for the first since you installed, or updated to, the latest version. Do you have any way of confirming or denying that guess?
  3. Is it the case that the problem goes away when they refresh the page?
  4. Has the same student, using the same browser, ever seen the problem twice?
  5. Have you seen the problem with other Moodle themes, or haven't you tried using other ones?
  6. Can your confirm that all the reported cases relate to an Alert box coming up? I mention this because there's another type of UI Load failure, which I do see reasonably frequently, which occurs when a browser accesses CodeRunner (or, to be precise, the Ace editor) for the first time since Moodle was upgraded. In this version of the load failure, the student sees a normal text box rather than an Ace editor box, but with UI Load Failure written just above it. I understand this issue, but as it's hard to fix and is a one-off problem which goes away as soon as the page is refreshed, I'm just having to live with it for now.
  7. Is it possible that the issues also arise only when quite a few students are accessing the docker Moodle container? I've written the code so that even if a race problem occurs the Alert shouldn't come up provided Ace can be loaded within 4 seconds. I could of course increase that timeout.

Meanwhile, I'll start poring over the code again to see if I can find any potential race problems. I should perhaps mention that JavaScript problems of this sort are normally solved by appropriate use of 'require'. However, the Ace editor doesn't conform to Moodle coding standards (meaning it's not an AMD module), so I have to cheat a bit, and that's where the issue is probably arising.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/trampgeek/moodle-qtype_coderunner/issues/58#issuecomment-394070830, or mute the thread https://github.com/notifications/unsubscribe-auth/AA8ZTE6MwrjZ0N6pRi_pNp1pOUuZLocPks5t4lDtgaJpZM4UXgLr .

trampgeek commented 6 years ago

Thanks for the clarification Dirk. In that case I think I mostly understand the problem, which arises because the Ace editor is not an AMD module like other Moodle JavaScript plugins.

It hasn't been a significant issue for us as I believe it only occurs the first time a student visits any CodeRunner page on a new or updated Moodle (or they change browser). If you find that's not the case, please post back here.

I'll see if I can find a better solution but in the meantime would changing the message to something like "Ace editor not yet ready. Please reload" help?

Richard

tijcolem commented 6 years ago

Hi Richard,

I work with Dirk and we just spoke and we agreed that having an message such as "Ace editor not yet ready. Please reload" would be a more suitable message as this doesn't imply an error or missing a Plugin dependency issue. Would you mind changing? Thanks for supporting such a great tool!

Tim

trampgeek commented 6 years ago

OK, I've done that in my development system. It'll go out on the next push, hopefully within the next few weeks.

I'll close this issue but please re-open it if the issue turns out to be more serious than implied by the above explanation. Thanks for reporting.

Richard