Cache problem: CSS not loading after upgrade

Cache problem: CSS not loading after upgrade

by Harshita Kapoor -
Number of replies: 10

After upgrading from moodle 3.0.2 to moodle 3.1, the site front end does not load properly, with Clean theme. After clicking on 'purge all cache', the website loads well on Google Chrome but does not load on Mozilla Firefox and IE. Walkthrough of the Problem:

1. Load site on Google Chrome -> Loads properly

2. Load site on Mozilla Firefox/IE -> Does not load properly

3. Load site on Google Chrome again -> Doesn't load properly

4. Purge all cache on Google Chrome -> Loads properly

5. Load site on Mozilla Firefox/IE -> Does not load properly and so on and so forth.

Tried turning on debugger from Site Admin-> Debugging, but does not show any error.

Removed slash argument from HTTP, as I read on some solution suggested to a similar problem, but did not work.

Please help...the entire website is down. I have tried 3 fresh upgrades to the entire site, but the same problem persists. 

Attachment Capture.JPG
Average of ratings: -
In reply to Harshita Kapoor

Re: Cache problem: CSS not loading after upgrade

by Ken Task -
Picture of Particularly helpful Moodlers

In FireFox turn on Web Developer tools and set to Debugger.

Then surf to your site.

Click the "networking" tab in the Web Developer tool.

Then click the reload button in the web developer window.

Does that show anything that helps?

Installing three times and begetting the same results either indicates in-correct installation or other error - suspect ownership/permissions not liberal enough on moodledata directory and it's contents..

How do ownerships / permissions look in the moodledata directory.   Set those liberarllly such that the globe (everyone/all) can at least READ all files/folders in moodledata.   The css files are cached in moodledata/localcache/ somewhere.

'spirit of sharing', Ken


In reply to Ken Task

Re: Cache problem: CSS not loading after upgrade

by Harshita Kapoor -

Hi Ken,


Thank you for your reply. I tried following your suggested steps on Mozilla Firefox, and got the following two suspicious results with Status Code: 304 NOT Modified

1.       GET /theme/yui_combo.php?rollup/3.17.2/yui-moodlesimple-min.css HTTP/1.1

Host: <website url>

User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:47.0) Gecko/20100101 Firefox/47.0

Accept: text/css,*/*;q=0.1

Accept-Language: en-US,en;q=0.5

Accept-Encoding: gzip, deflate

Referer: <website url>

Cookie: MoodleSession=qp7o1v6ijv085d99kdtonq1nt7

Connection: keep-alive

If-None-Match: W/"PSA-aj-lUcX9WZW5o"

Cache-Control: max-age=0

 

Timings:  Waiting 212 ms

 

2.       GET /theme/styles.php?theme=clean&rev=1467671714&type=all HTTP/1.1

Host: <website url>

User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:47.0) Gecko/20100101 Firefox/47.0

Accept: text/css,*/*;q=0.1

Accept-Language: en-US,en;q=0.5

Accept-Encoding: gzip, deflate

Referer: <website url>

Cookie: MoodleSession=qp7o1v6ijv085d99kdtonq1nt7

Connection: keep-alive

If-None-Match: W/"PSA-aj-XGuQ_ak_jE"

Cache-Control: max-age=0

 

Timings: Waiting 75 ms

 These files were never received as per the timing. Don't know if this is the problem. Also I checked the permission for Moodle data which is set to 0777 which is for world to read/write/execute. In moodledata/localcache all the directories are set to 0777. 


P.S. Everything was working fine after the first time I tried to upgrade, till I used a local plugin for user tour in combination with another theme. Something went wrong while updating the user tour, post which I uninstalled that plugin but the problem didn't go away. Then I did a fresh install and upgrade without any theme or local plugin, hoping to revive back to a stable state, but in vain. And I did another install, presuming I am missing out something still didn't work. This is how I ended up doing three fresh upgrades. I am clueless what went wrong where. 

Thank you for your help,

Please help me figure out something I am missing on (maybe).

In reply to Harshita Kapoor

Re: Cache problem: CSS not loading after upgrade

by Ken Task -
Picture of Particularly helpful Moodlers

Those really don't look suspicious to me at all ... of course, I don't have the URL to your site to check myself.   Heck, your Moodle is NOT going to be totally private where only certain IP addresses can see/view/use it, is it?

There is a lot of caching going on ... browser, Moodle (now in moodledata/cache moodledata/localcache moodledata/MUC/ plus php-opcache, etc.    Does your setup use any memcache/memcached?

[root@sos moodle31data]# find ./localcache/ -name \*.css
./localcache/theme/1465676024/clean/css/all.css
./localcache/theme/1465676024/clean/css/all.2.css
./localcache/theme/1465676024/clean/css/all.0.css
./localcache/theme/1465676024/clean/css/all.1.css


Ahhhh ... new info ... not before disclosed ... 'till I used a local plugin for user tour in combination with another theme'  So you removed the local plugin but what of the theme you installed?  or did I mis-undertand that?

Anyhoooo .... think we need to get nasty now ...

cd /pathtomoodledata/moodledata/

cd sessions

rm -fR *

cd ../cache

rm -fR *

cd ../localcache

rm -fR *

cd ../

ls -lR cache - anything there? shouldn't be.

ls -lR localcache ... anything there?  shouldn't be.

ls -lR sessions ... anything there?  Then someone hit the site and might have logged in on ya.

restart web service - that should re-populate any php-opache.

Got anything running to help protect Moodle that might be involved?  suPHP or seLinux or whatever?

While apache is restarting, **clear ***all*** browser caches ... IE, FireFox, Chrome ... whatever you have for browsers.  None of those share caching so you have do them all - one at a time.

Then, try the site ... with Firefox first so you can do the Web Tools thing with it.

It should appear slower at first, but clicking around the site the cache and localcache diretories will begin to populate.

Don't think you need to do a fresh install of anything ... heck, originally this was an upgrade.

And assume you've double checked all ownerships/permissions again.    Yeah, I know. ;)

'spirit of sharing', Ken


In reply to Ken Task

Re: Cache problem: CSS not loading after upgrade

by Harshita Kapoor -

Sorry for not sharing the website link

course.codewizacademy.com

Meanwhile, I am trying your suggested followup.

Thanks.

In reply to Harshita Kapoor

Re: Cache problem: CSS not loading after upgrade

by Ken Task -
Picture of Particularly helpful Moodlers

Site loads for me.   No errors.    See attached.

This could have been a sessions issue ... admins always have larger session info and often get caught in confused states when doing upgrades.

Would turn off those things that provide the extra info at the bottom ... forgot what they are called and where you turn them on, but they really won't fix the problem ... but might make it more difficult to determine issues.

See running bwlimited and fcgid - those didn't seem to affect my access, however.

Maybe?

https://httpd.apache.org/mod_fcgid/mod/mod_fcgid.html

under: Special PHP considerations

The popular APC opcode cache for PHP cannot share a cache between PHP FastCGI processes unless PHP manages the child processes. Thus, the effectiveness of the cache is limited with mod_fcgid; concurrent PHP requests will use different opcode caches.

Probably shouldn't be running APC opcache but built in php-opache.   Might check your phpinfo to see settings for php-opcache.

3.1.1 ... that's 'bleeding edge' huh?   Was just the other day that an annoucement was made coming this week.

If you are gonna make that a habit, suggest coming up with a routine ... somewhat like what we've done ... to do on every leap to 'bleeding edge'. ;)

'spirit of sharing', Ken



Attachment Screen Shot 2016-07-05 at 12.20.47 AM.png
In reply to Ken Task

Re: Cache problem: CSS not loading after upgrade

by Harshita Kapoor -

Hi Ken,

Thank you very much for your help. I tried executing the bash commands that you suggested, after which the site was working properly on Mozilla Firefox and Google Chrome, till the time I tried using IE. The site did not load on IE and other devices i.e. tablet and phone.

I used the developer tool in Mozilla firefox, as suggested by you. While trying to figure out the error, the debugger there showed some weird symbols at one of the loading instances, which I could relate to the page speed post. For reference- https://moodle.org/mod/forum/discuss.php?d=330820

This finally worked for me as well. I disabled page speed from the server and it seems to be working fine now.

Hopefully, It continues to work as expected now. It was a great learning for me.

Thank you,

Harshita

In reply to Harshita Kapoor

Re: Cache problem: CSS not loading after upgrade

by Ken Task -
Picture of Particularly helpful Moodlers

Welcome and congrats!   PageSpeed ... yeah, a year or so ago I investigated 'speeding things up'  and ran across PageSpeed (somethhing Google was developing and 'pushing' at the time).  It is an apache extension.   Works well with static sites (authored by DreamWeaver or whatever Google sites uses) but didn't play well with dynamic sites ... such as WordPress, Drupal, Moodle.   As a result, un-installed it and looked else where.

Maybe the forum recommendations for what information posters should provide when asking for assistance should now include output of apache config ... along with PHP info, etc..

'spirit of sharing', Ken

In reply to Ken Task

Re: Cache problem: CSS not loading after upgrade

by T K -

Hi Ken,

Ive been having this problem with my moodle site, and i came across this solution.

Summary of my problem:

_______________________________________________________________________________________________

I'm using moodle 2.8 with essential and some customised themes. I had just added a new category with new category icon settings at custom CSS portion of essential theme, and suddenly ALL my custom settings is gone, the color, the icons, everything. This even affected my other custom themes using clean theme.


What is wrong? I surely did not add/remove anything other than the category icon settings.

i did try to change the theme, it loads with NO css settings as earlier. I even reboot the server twice. 

I just tried the debugging option, and no i see no error at all.

_______________________________________________________________________________________________

you can see below, even the icons are not appearing:


cssproblem


I tried the web developer tool method,and this is what i got:

webdeveloper error


Details:

error details



I wonder if your method of clearning cache, localcache & sessions would help?

In reply to T K

Re: Cache problem: CSS not loading after upgrade

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

The obvious solution would be to remove the custom css that you added that caused the problem.  Did you try that?

This should really be moved to the themes forum.

In reply to Emma Richardson

Re: Cache problem: CSS not loading after upgrade

by T K -

my additional css was very simple, just a copy with different parameters, and i removed it, yet still the same.