Code editor not loading (too slow)

Code editor not loading (too slow)

von Stefan Mueller -
Anzahl Antworten: 3

Hello Richard

Long time no see but still relying heavily on CodeRunner. I have used it for litterally thousands of individual student sessions and it has always worked very will. Thank you once again for this masterpiece!Over the years I have observed one regular hick-up which is the code editor not loading in time. Students are presented a totally basic text editor without syntax highlighting or similar features. Typically this happens for about 10% - 20% of the students. The successful work-around consists in simply reloading the page. After that the problem does not reappaer in this session. However, it is a stumbling block for some students and part of the code may be lost due to insufficient cacheing.

I believe that the JS-code for the editor does not load in time. I am not familiar with the internal workings of CodeRunner and do not have much experience with different text editors in Moodle. Therefore I do not know how to explain the problem in more detailed terms, sorry! However, I just found the following forum post about Ace editor loading issues which seems to be the very same issue. You mention that you intend to distribute the non-minimised build of Ace in the standard CodeRunner release. Have you already done that? I am running CoderRunner in version 5.1.1 (2022110900).

Thanks in advance for any suggestion!

Sincerely,

Stefan

Als Antwort auf Stefan Mueller

Re: Code editor not loading (too slow)

von Richard Lobb -
Hi Stefan. Good to hear you're still finding CodeRunner so useful.

I switched Ace to the non-minimised version back around the time of that previous forum thread. I haven't been aware of any significant Ace loading problems since then. We do occasionally see the "Ace failed to load" message, usually only after a CodeRunner version update or when a student uses a new machine or browser. I don't see students struggling with it in our labs and certainly not 10 - 20% of the time.

I believe Moodle has made major changes in its JavaScript handling since the 2020 thread but because what we have now works OK for us I've never really looked into the changes.

I'd like to understand why your experience is so different from ours. Are your students having these issues working in a computer lab with University machines, or using their own laptops? And what OS/browser are they using?

Could you enable the developer tools in Chrome, please, and inspect the network tab following a page load. You should see a sequence of three or four Ace-related loads: ace.js, ext-language_tools.js, ext-modelist.js and perhaps ext-static_highlight.js. If you click on these in turn, you'll see how they were loaded. For example, I see:



The two key things are the specific resource ID number embedded in the Request URL and the fact that it was loaded by the browser from its own cache. Also note that the resource was last modified on our server on 4 Sep this year and the cache copy doesn't expire until 25 Jan next year (or CodeRunner is updated, of course).

I'd be interested to hear what values you get on the first CodeRunner question load after machine start up, in the middle of a session, and at the start of a new session without powering down. It sounds like the browser cache is being cleared at the start or end of each session in your environment. That would certainly exacerbate any problems but even then I wouldn't have expected such frequent load failures. I'm wondering if caching is failing at the server end as well (which would change the resource ID).




Als Antwort auf Richard Lobb

Re: Code editor not loading (too slow)

von Stefan Mueller -

Thanks for your immediate response, Richard! After reading your answer, I can add some more details.

Now that you mention it, I recall seeing the message "Ace failed to load" in the past but not anymore. I would guess that this is due to upgrading Moodle (to 4.1) and CodeRunner (to 5.1.1)  which happened this summer. Since then I have not seen this message anymore in any case where the editor did not load.

In the course of that over-haul I have switched to Safe Exam Browser (SEB) on the students' (Windows) laptops now but prior to that the students worked in a computer lab with Firefox on a supervised Linux live-system that provides a clean installation every time it is started. Thus there was no caching over sessions and I suppose that SEB works in a similar fashion. However, once Ace editor has loaded the issue does not reappear. So I think that browser caching does work as intended. 

However I do not see how I can easily trouble-shoot the faulty behavior because AFAIK there is no developer console in SEB and the regular browser (Edge, Chrome) most likely will do cache as intended. Maybe I can test in a private tab as in Firefox but I have to find out about JS caching there.

My Moodle and Jobe servers run off-premise in my private server environment at home. I believe that explains why loading times are an issue that nobody (?) else seems to experience as probably most institutions use local servers. The internet connection provides 100 Mbps ("upload" speed as seen from my home). Maybe that is a bit too tight? There usually are about 20-25 exams running in parallel and the problem appears at the first loading of the exam page by Moodle.

The network connection for the students has changed as well and now incorporates a firewall with deep packet inspection. That may slow down the connection as well. Based on my recent experience it is more like 20% - 25% (!) of the exam sessions that are affected now as to 10% - 15% before. However, I would not label the network as slow at all.

Is there a way to increase the loading time-out in Moodle or elsewhere? Might a content delivery network be of use?

Als Antwort auf Stefan Mueller

Re: Code editor not loading (too slow)

von Richard Lobb -
The fact that you're having these problems with SEB does complicate matters. Is it only with SEB? Can you replicate any of the problems with Firefox or Chrome? If so, I think it would still be useful to use the developer tools to see how long the load of the various Ace elements is taking when not coming from cache. And by the way - Firefox has a similar network tab to Chrome in its Developer Tools.

I'm surprised you're not seeing an Ace load failure message. Here's what I see if I deliberately raise a JavaScript exception during the loading of Ace. This is with the latest versions of Moodle and CodeRunner but shouldn't have changed in recent years.



If you can't replicate the problem in a standard browser like Chrome or Firefox then I'm afraid I can't offer much in the way of help, as there's no way to find out exactly what is happening.