Seemingly random loss (i.e. they don't even attempt to load) of css/js assets

Seemingly random loss (i.e. they don't even attempt to load) of css/js assets

by Chris Rockwell -
Number of replies: 8

I am using Moodle 3.7.1 with php 7.2.24 (via php-fpm) on Apache 2.4.6.  We are getting reports of, and I can sometimes reproduce, instances where the page loads but appears to only load the HTML - I'm attaching 2 screenshots of what is actually loaded on different pages when this occurs.

This started happening when we upgraded Moodle, which coincided with a php version upgrade.  The theme we are using is a child of the Herald Boost and Boost themes

$THEME->parents = ['herald_boost', 'boost'];

Here is a diff between herald_boost/config.php and spark_learn/config.php: https://www.diffchecker.com/jWLRCYdQ

If I purge cache the issues goes away.  There are no console errors (e.g. 404, 500) and no php/httpd errors logged either.  In some instances, if a user reports it, I can open in a browser I rarely use and get the same result, but in my day-to-day browser I can continue to use the site normally.  Again, purging cache fixes the issue for everyone.

Obviously I'm unable to reliably reproduce so I'm reaching out in the hopes someone else with more Moodle experience can point me in the right direction.

Attachment Screen Shot 2020-01-14 at 9.02.59 AM.png
Attachment Screen Shot 2020-01-14 at 9.03.15 AM.png
Average of ratings: -
In reply to Chris Rockwell

Re: Seemingly random loss (i.e. they don't even attempt to load) of css/js assets

by Ken Task -
Picture of Particularly helpful Moodlers

Since you've reported cleaning caches clears the issue ...

In /admin/tool/task/scheduledtasks.php
what is setting for
Background processing for caches (core)?
Default is to run every 50 minutes ... might consider lowering that value to 30 (run more often).

Could run from command line in moodlecode/admin/tool/task/cli/ script
schedule_task.php with option to run just the cache_cron_task

\core\task\cache_cron_task

'SoS', Ken


In reply to Ken Task

Re: Seemingly random loss (i.e. they don't even attempt to load) of css/js assets

by Chris Rockwell -
Thanks for the reply Ken!

This is a page I've never gone to and you're correct: it is set to 50 minutes. However, I also noticed that "Last Run" for all of these *except* "Background processing for statistics" is "Never" (event that job hasn't run since 12/18/2019). That makes me think I have a misconfigured (or not at all configured) cron job. I'll investigate that path before changing the settings.
In reply to Chris Rockwell

Re: Seemingly random loss (i.e. they don't even attempt to load) of css/js assets

by Chris Rockwell -
Ahhhh, when running cron from command line, which is what the cron job does, I get: "Moodle 3.2 or later requires at least PHP 5.6.5 (currently using version 5.4.16).". So although apache is running 7.2 CLI is still on a legacy version.
Average of ratings: Useful (1)
In reply to Chris Rockwell

Re: Seemingly random loss (i.e. they don't even attempt to load) of css/js assets

by Ken Task -
Picture of Particularly helpful Moodlers

which php

should find php-cli ... note full path.

Check which php version as one could be using cPanel with EasyApache and system actually has multiple php versions.  env command and look for $PATH=

/full/path/php -v

If you don't see php-cli wrong one.

Test running code/admin/cli/cron.php using full path shown from which php ... that php-cli is the one used to config cron job.

'SoS', Ken

Average of ratings: Useful (1)
In reply to Ken Task

Re: Seemingly random loss (i.e. they don't even attempt to load) of css/js assets

by Chris Rockwell -
Thanks again, Ken!

I needed to make a special request to get PHP 7.x so it was installed as php-fpm. From what I can tell, I can't configure CLI to use php-fpm without additional dependencies.

This is an enterprise environment and upgrading the CLI version of PHP just isn't going to happen until it's officially released with RHEL. A good workaround was to update my cronjob to use `curl https://domain/admin/cron.php?mysupersecurepassword` and, so far it's working well.

Thanks again, it might have taken me many, many days (weeks?) to discover that Scheduled Tasks page!
Average of ratings: Useful (1)
In reply to Chris Rockwell

Re: Seemingly random loss (i.e. they don't even attempt to load) of css/js assets

by Ken Task -
Picture of Particularly helpful Moodlers

Welcome!  Your solution works ... for now ... but   '... special request!!!!???? ....'

php-cli isn't the same as the php that is used for web service (assuming apache ... php-fpm).

Think you might need to re-think.   Go to Site Admin -> Server -> Environment - update component ... then select higher versions of Moodle to see what you'll need

True RHEL vr 6,7, and probably 8 have always been 'conservative' when it comes to php versions provided by their repo.   Thus a reputable 3 party repo needed to keep pace with PHP.

For php,  remi repo and/or webtatic repo are pretty good.   There are others.

So you've got a work-around in place right now ... not yet done (never is).   And it's just for cron ... but, there are some useful CLI only scripts through out moodle code.

Those in moodlecode/admin/cli/ have been extremely useful.

Speaking of 'useful' .. please feel free to rate any of my responses as 'useful' ... it's a way of saying thanks + I 'earn a badge'! smile

'SoS', Ken



In reply to Ken Task

Re: Seemingly random loss (i.e. they don't even attempt to load) of css/js assets

by Chris Rockwell -
Unfortunately this didn't resolve the issue. I now have the "Background processing for caches" happening every 15 minutes and we're still getting this issue.

Any other things I might need to check?

Thanks!
In reply to Chris Rockwell

Re: Seemingly random loss (i.e. they don't even attempt to load) of css/js assets

by Ken Task -
Picture of Particularly helpful Moodlers

So is it safe to say this is theme related?

harold_boost theme is commercial ... from checking their page kinda an expensive one at that! :|   That to say, am not gonna try and load it up to see what's what.

https://elearning.3rdwavemedia.com/themes/moodle-theme-herald-boost/

Above link does say free theme support however.   So you might want to contact them.

Before you do, however, how about setting to the default 'boost' and let it run like that for a couple of days to see if issue continues.

Might be a good time to do a DB dump and archive of moodle code (a backup).

'SoS', Ken