Theme and plugins suddenly not working

Theme and plugins suddenly not working

by C. Bayer -
Number of replies: 17

Hi Community,

we have a strange behaviour with our Moodle installation for a couple of weeks. The problem is that suddenly, without doing any changes in the backend or elsewhere, our Theme and other plugins seem to not work anymore and all requests to "/pluginfile.php/..." get a 404 error in the log file. All other requests work fine. The error appears every few days and lasts between a few minutes to multiple hours.

The error is active for a few weeks now - before that, we had no problems with Moodle for a very long time. Interestingly we noticed that when the error is active and we visit the "/admin" area of Moodle, the URL is rewritten to "/admin/index.php?cache=1". When we call this URL during the error is active, the error immediately disappears and everything is working fine again. It seems like it has something to do with the "cache=1" parameter in the URL.

I have to mention that we switched to a new Moodle theme about 3 months ago (Adaptable). We already tried to get support from their website, but they said that this must be a problem with Moodle and not with their theme.

We also installed a new plugin some weeks ago (qtype_algebra) which first made some problems during installation but now works fine. All plugins are up to date without error in the plugin list. Moodle has all its newest patches and updates:


- Moodle 3.1.11+ (Build: 20180329)

- No error messages, except the 404 errors in the logs (mentioned above) during the error is active

- Ubuntu 16.04 and Apache Web server with PostgreSQL database


As this is a productive website - any help would be really fantastic!

Thank you,

Claus

Average of ratings: -
In reply to C. Bayer

Re: Theme and plugins suddenly not working

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

What's in the *error* log for these problems? I think you are looking at the access log.

In reply to Howard Miller

Re: Theme and plugins suddenly not working

by C. Bayer -

Thank you for your answer!

There is no entry in the error.log which points to the error, only the access.log shows the mentioned 404 errors to the pluginfile.php

In reply to C. Bayer

Re: Theme and plugins suddenly not working

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Then you're looking in the wrong place. It's highly unlikely an error 404 would not generate an error log entry. 

Also, switch on Debugging in Moodle. That should log even more info.

In reply to Howard Miller

Re: Theme and plugins suddenly not working

by C. Bayer -

The problem is that the error only occurs sometimes, so we can not reproduce it. It is not possible for us to have debugging enabled on a production website for several days.

In reply to C. Bayer

Re: Theme and plugins suddenly not working

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

You may have to if you want to get to the bottom of this...

In reply to Howard Miller

Re: Theme and plugins suddenly not working

by C. Bayer -

Agree, but I still hope to avoid that as this would surely slow Moodle very much.

In reply to C. Bayer

Re: Theme and plugins suddenly not working

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

No... turning on debugging should not slow Moodle at all. Perhaps you are thinking of Theme Developer Mode?

In reply to Howard Miller

Re: Theme and plugins suddenly not working

by C. Bayer -

I thought this would be a huge performance issue on a productive website. I will try this, thank you!

In reply to C. Bayer

Re: Theme and plugins suddenly not working

by Just H -
Personally I turn it on only for admin/whatever tech staff you have via the config file when having issues ... better than everyone seeing a problem. 
In reply to Just H

Re: Theme and plugins suddenly not working

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

.....I got the impression that it could be *anyone* having the problem. Therefore just enabling debugging for all will probably log the problem much faster. 

In reply to C. Bayer

Re: Theme and plugins suddenly not working

by Justin Hunt -
Picture of Particularly helpful Moodlers Picture of Plugin developers

I cannot explain why it suddenly happens, or why it started. But I think you check if your server is set up to use "slash arguments"

https://docs.moodle.org/34/en/Using_slash_arguments

This is the difference between /pluginfile.php/id=xxx and /pluginfile.php?id=xxx

Somehow I think your site has them turned off 

In reply to Justin Hunt

Re: Theme and plugins suddenly not working

by C. Bayer -

Thank you for your answer but slash arguments are enabled on our servers. 

What about the fact that calling "/admin" routes to "/admin/index.php?cache=1",  is this normal behaviour? And what does the "cache=1" parameter do? I think it is very interesting that apparently this always causes Moodle to function again.

In reply to C. Bayer

Re: Theme and plugins suddenly not working

by Colin Fraser -
Picture of Documentation writers Picture of Testers

When you switched themes, did you clear out the old theme by using the "Clear theme caches"? Shouldn't cause a problem if you hadn't but.... What would happen if you were to enter Appearance > Theme Selector and click that button now...mmmm

In reply to Colin Fraser

Re: Theme and plugins suddenly not working

by C. Bayer -

Yes, I cleared the theme cache - multiple times as we noticed problems with the website. 

Does anybody know what the "cache=1" parameter in the URL does? I think this might be the key to find the problem.

In reply to C. Bayer

Re: Theme and plugins suddenly not working

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

I deleted the asking the above question in a new thread. I couldn't see any point starting a new thread and it will just split/confuse the discussion.


How did running with debugging on go?

I think the cache parameter (when it is 0 or not there at all) runs a sort of minimal version of that page during upgrade or installation when (things like) caching services may not be available. That means cache=1 implies 'normal' operation. It also means that this page must have been called from somewhere else (that added the parameter)

In reply to Howard Miller

Re: Theme and plugins suddenly not working

by C. Bayer -

As I wrote in this thread earlier, calling the URL /admin redirects to /admin/index.php?cache=1. Doing this stops the error I described here immediately. It is very important for me to know what this call does in Moodle as knowing that might lead to the solution of the problem. I asked several times what the cache=1 parameter is doing but unfortunately didn't get an answer in this thread. That was the reason I started a second thread as it was not the main question of this thread's subject and other users, which could probably help me with the cache=1 information, might not read this thread because of its subject. I hope you understand that we need urgent help, so getting the right information as fast as possible is very important at the moment. 

Regarding your answer, does this mean that during the lifecycle of the request of /admin, the cache parameter might have been set to 0 (cache=0) internally and then redirected to 1 (cache=1)? If yes, maybe Moodle refreshed the cache with this operation?

Debugging is activated but it might take some days until the error occurs again. 

Thank you!

In reply to C. Bayer

Re: Theme and plugins suddenly not working

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Ok... but still, however urgent it is, please don't start new threads for what is basically the same problem. It's in your own interests. Honestly wink

I've never looked at this code before and didn't write it. I just had a look through to see how this parameter was being used in the code. When this is set to 0 a number of things are not loaded. My conclusion is that this is used during installation when a lot of processes are not yet set up. 

In your case, setting it to 0 is presumably not loading whatever it is that is breaking your site. The cache=0 is masking the problem, not the direct cause. 

Again, if you cannot reproduce it then I think proper logging is your only reasonable hope. 

If this was me, I would enable full debugging and then stop worrying about it. Wait for something to appear. Or, failing that, try to work out how to reproduce it (which I think would lead you directly to the solution anyway)