Messaging system not loading/working for some users

Messaging system not loading/working for some users

by Will B -
Number of replies: 32

Hi all,

For some reason, suddenly the messaging system has started to malfunction for a few users. It works fine for me personally, but for one of our site managers, the messages won't load and nor will the physical link (moodle/message/index.php).  It's definitely not a browser issue as I can recreate the issue by logging in as the user.

No errors on the web server either, so not sure where to go from here. The user is getting notification of  message but can't physically open it.

We are on Moodle 3.9.4

Any help would be greatly appreciated as it is affecting our learners. 

Thanks in advance smile


Average of ratings: -
In reply to Will B

Re: Messaging system not loading/working for some users

by Felipe Almeida de Souza -
Did you manage to solve it? Im facing the same issue
In reply to Felipe Almeida de Souza

Re: Messaging system not loading/working for some users

by Will B -

I did, yeah.

Run MySQL tuner on your DB if it’s the exact same issue. It will solve it.

mysqlcheck --optimize database_name

where database_name is the database you’re using for your Moodle site

Take a backup beforehand just in case.

Thanks!

Will

Average of ratings: Useful (2)
In reply to Will B

Re: Messaging system not loading/working for some users

by Ian L -
I have the same problem and can you offer any more info I don't have a mysql tuner. I did try to "Repair database" by going to CPanel-mysql databases, but that didn't help.
In reply to Ian L

Re: Messaging system not loading/working for some users

by Felipe Almeida de Souza -

The mysql tuner process you can do via SSH or if you have access to the WHM server via terminal.

I did the process but in my case the real problem was the theme. I updated the theme to the last version and work like a charm.

You can follow this guide starting on "How to use MySQLTuner for MySQL Performance Optimization?" step 1 and 2. After that you follow the commands that Will B mentioned.

https://hevodata.com/learn/mysqltuner/

Sorry about my english, isn't my first language.

In reply to Felipe Almeida de Souza

Re: Messaging system not loading/working for some users

by Ian L -

I don't have access to terminal it's on a shared server. I think I use the standard them and was on 3.7 which was fine for years and then I got that problem recently and then updated to 3.11 and the problem didn't go away. 

Wish my Spanish was as good as your English if that's your 1st language..

In reply to Ian L

Re: Messaging system not loading/working for some users

by Felipe Almeida de Souza -

You can ask for the server providers to give you SSH access to your cpanel account and also install mysqltuner (in some cases it is already installed by default).

After that, using the software putty you can connect to your cpanel via SSH and run the mysqltuner.

In reply to Felipe Almeida de Souza

Re: Messaging system not loading/working for some users

by Ian L -

I don't have access to it.

In reply to Ian L

Re: Messaging system not loading/working for some users

by Ken Task -
Picture of Particularly helpful Moodlers

Since, on your shared hosting plan, you don't have access to tools that would/might solve your issue, try this:

As admin level user, can you get to:
Site administration
Messaging
Messaging settings

There you will see 2 settings for Delete.  Set those to the lowest ...
like 1 week to 1 day ... 1 months to 1 day.

If your cron job is running correctly those should reduce the number of
messages retrained.   Your screen shot of the user having issues showed 4 new
and 495 or so retained ... that's a lot of junk (old past info needed?)

And, if you noticed, those responding, suggested using tools outside of moodle ... how you are hosted (shared hosting) makes a difference.

'SoS', Ken

In reply to Ken Task

Re: Messaging system not loading/working for some users

by Ian L -
Thanks I am trying but the message settings link is loading very slow. I realized today that i upgraded to 3.11 and the mysql version requires 5.7 but my server is only 5.6.43 or something. Is that going to be a problem? Should I revert?

I got the php version set to 8.0.
In reply to Ian L

Re: Messaging system not loading/working for some users

by Ken Task -
Picture of Particularly helpful Moodlers

Well, your environment check needs consulting - everything in there should be 'green' - or OK.   'or something' .... running server software is usually exacting.  Moodle has always been keen on versions of MySQL/PHP.  So if environment check shows your DB version isn't what it should be, there will be problems.

Ditto goes for version of Moodle and version of PHP.

Check: http://www.syndrega.ch/blog/#php-and-dbms-compatibility-of-major-moodle-releases

Ok, fine  .... not your screen shot.   Sometimes multiple posters in same thread confuses those attempting to help.  My bad!

As far as use of messages ... if it's causing problems and issues, you have to change something ...  do something different, wouldn't you agree?   So what's the number of messages in accounts that are having issues?

Question ... since you are on shared hosting, how do you upgrade your Moodle?

'SoS', Ken


In reply to Ken Task

Re: Messaging system not loading/working for some users

by Ian L -

As far as use of messages ... if it's causing problems and issues, you have to change something ...  do something different, wouldn't you agree?   So what's the number of messages in accounts that are having issues?

But change what? IDK the number of messages in accounts that are having issues. Everytime I go to a user account and try to message them I get this prob.

How does Moodle suddenly get a problem? This just started randomly and I had made no changes to anything. how does that happen?



In reply to Ian L

Re: Messaging system not loading/working for some users

by Ken Task -
Picture of Particularly helpful Moodlers

So it's your account, not students accounts.   So how about a screen shot of your Messages interface ... your account.

Nothing really happens 'suddenly' in moodle ... more like finally reach thresholds which then start to exhibit things like 'slowness'.

Suggestion was to reduce the default values ... pick list shows what they are at present.   Choosing something less should tell you moodle to remove rows in the DB.  Would assume the oldest goes first.

When one is on shared hosting, such 'sudden' behavior is an indication that shared hosting isn't providing the server resources you need to do what you are doing and how you are doing it.

'SoS', Ken


In reply to Ken Task

Re: Messaging system not loading/working for some users

by Ian L -
In reply to Ian L

Re: Messaging system not loading/working for some users

by Ken Task -
Picture of Particularly helpful Moodlers

Screen shot did not show the total number of of messages in your account
like the other users screen shot did.
 
In that thread, Howard gave you the answer:
https://moodle.org/mod/forum/discuss.php?d=435857#p1754032

"Debug info: MySQL server has gone away"

The listing of messages overtaxed your DB server.
Check your config.php file for the DB server.
Is it localhost?

Gone away is usually indication that DB server config for max_allowed_packets is too low.

https://docs.moodle.org/400/en/MySQL
where is says:
"Increase the 'max_allowed_packet' setting to at least 4 megabytes"

On shared hosting, you might not have access to do that so contact hosting
provider.

If hosting provider will not do that for you on shared hosting, you are looking at either setting things lower - thus deleting rows - loosing info - OR upgrading your hosting.

Don't know where you host nor what they offer for upgrading shared hosting to something where you can allocate more resources for your DB.   That's between you and hosting provider.

'SoS', Ken

In reply to Ken Task

Re: Messaging system not loading/working for some users

by Ken Task -
Picture of Particularly helpful Moodlers

Follow up - might indicate a more urgent pursuit to hosting situation ... and DB server settings.

Do you make backups of courses?

IF not, let's see if you can backup your largest/most used course.  Make the backup of that course selecting to include all parts of the course.

IF there is an error, copy the text of that error into a text file, then come back here and share what it said.

'SoS', Ken


In reply to Ken Task

Re: Messaging system not loading/working for some users

by Ian L -
Other people have had this problem too and some said it was the theme and some were able to resolve it with mysql tuner but it's likely not a theme thing. https://moodle.org/mod/forum/discuss.php?d=379692#p1531931

I use the standard theme too.
In reply to Ian L

Re: Messaging system not loading/working for some users

by Ken Task -
Picture of Particularly helpful Moodlers

Can you install mysqltuner on your shared system?  It is a perl script and command line only.    You said you don't have that type of access.

Tuner may have led them to discover what your debugging showed you ... 'Server has gone away' - moodle docs say that should be at least 4 Meg.

https://docs.moodle.org/400/en/MySQL

where is says "Increase the 'max_allowed_packet' setting to at least 4 megabytes."

Since you have phpmyadmin, you might be able to run the following query:

show variables like 'max_allowed_packet'

That should show you the value in bytes

If you cannot do that, ask provider help desk what the value for max_allowed_packet is and ask them to increase it.    Uhhh ... don't be surprised if they refuse as that is a setting that affects all users on a shared system - and not just your setup.

'SoS', Ken


In reply to Ken Task

Re: Messaging system not loading/working for some users

by Will B -
I'm the OP but actually having difficulty with a second site that has a similar amount of users. I have only had issues since upgrading to 4.0 last week, everything was fine before the upgrade to 4.

Ran the MySQL tuner, max_allowed_packet is set to 134mb - i've actually migrated this site to a dedicated server of its own as I thought it may be under resourced. Still getting messaging issues (won't load for 2-3 minutes), frequent DB connection errors.

I must stress, this has only happened since moving up to 4.0

Still chasing a loose end at the minute
In reply to Will B

Re: Messaging system not loading/working for some users

by Ken Task -
Picture of Particularly helpful Moodlers

@Will
In https://moodle.org/mod/forum/discuss.php?d=433340#p1743600
You said: 'We are on Moodle 3.9.4"
And the screen shot was yours ... 482 Private messages with 4 unread.

So the issue existed prior to upgrading to 4.

In https://moodle.org/mod/forum/discuss.php?d=433340#p1749668
You said:
"Run MySQL tuner on your DB if it’s the exact same issue. It will solve it."
and showed optimizing DB fixed.

Another user in this thread said:
"in my case the real problem was the theme. I updated the theme to the last version and work like a charm."

And now @Will you are at MySQL vr. 5.7? (DB server is localhost?) with PHP? and 4.0.x and saying not fixed ... still slow to load and getting:

"frequent DB connection errors" - which you did not get when site was a 3.9.x.

From your tuner run, (it is possible to tweak too high!) what do the following show?

Maximum reached memory usage

Maximum possible memory usage

Overall possible memory usage with other process is compatible with memory available

Slow queries

Highest usage of available connections

Aborted connections

InnoDB buffer pool / data size:

Reasons could be many ... here's a page that tries to address troubleshooting such issue:

https://www.knownhost.com/kb/troubleshooting-mysql-connection-errors/

Some of above should not apply to a moodle server.

Mind looking at: php -i |grep max

Specfically:

max_execution_time

max_input_vars

mysqli.max_links

If it is a bug in 4, one might need to file an issue in Tracker.   To do that and expect results, the filing needs to provide a way to replicate the problem so they can look into it.

'SoS', Ken

In reply to Ken Task

Re: Messaging system not loading/working for some users

by Ian L -

No I didn't you are mixing me up with someone else.

In reply to Ian L

Re: Messaging system not loading/working for some users

by Ken Task -
Picture of Particularly helpful Moodlers

@Ian

This appears to be a response to a posting addressed to @Will so not sure what you mean by 'No I didn't' ... didn't what?   And mixing up ... there is more than one in this discussion.  @Will appears to have more access (command line and can run tuner + change config) than you thus might be able to provide more info.   In these forums, one way to ask or interact with a specific user in a thread is to preface the posting with @username - which I did.

@all in this thread

Did find a posting about this issue that's now closed and old in which the OP said that when the display of messages reached 50 then it started to mis-behave ... no resolution to that.    I see no settings in config of messages for max number to display.


In reply to Ken Task

Re: Messaging system not loading/working for some users

by Will B -

Hi Ken,

The Moodle site mentioned in the OP is still running on 3.9.4 and running the mysql tuner fixed that. That particular site functions as expected with no issues at all.  This site still has over 500+ messages on that account but functions fine.  

----

The second Moodle site I have (different to the one in the OP) I have just upgraded to 4.0 and is experiencing the new issues where it's chucking out a lot of DB connection errors and takes a good 2-3 minutes to load messages.  I have ran the tuner on this site which hasn't improved anything.  I've moved it over to a private server as I thought it may be resource limitation on shared hosting but still experiencing the same issues.

It's important to note, these issues only came to life once I upgraded to 4.0.  I had gone from 3.4 > 4 and it was absolutely fine on 3.4.

I'm using Maria DB 10.4.24 which is compatible at least up to MySQL 5.7

Max execution time is set to 300

Max input vars is set to 5000

mysqli.max_links is set to unlimited.  

I can PM you the link to the full phpinfo if you need to see it.  I have also attached screenshots of other errors relating to DB issues since the upgrade.  Again, these didn't exist before the upgrade.

Thanks,

Will

Attachment Web Error_1.jpg
Attachment Web Error_3.jpg
Attachment Web Error_4.jpg
In reply to Will B

Re: Messaging system not loading/working for some users

by Ken Task -
Picture of Particularly helpful Moodlers

@Will ... thanks for screen shots ... we see some error screens ... for the first time!   Will look to see what I might be able to decipher (am not a programmer, however).

3.4 -> 4

Did you do the upgrades in stages or straight from 3.4 to 4?

'SoS', Ken

In reply to Will B

Re: Messaging system not loading/working for some users

by Ken Task -
Picture of Particularly helpful Moodlers

@Will

Uhhh ... am confused .. this thread is about messages and your screen shots appear to be about issues with File Picker! ??????????   How does that relate?

Suggest, if you having issues with File Picker, begin a new thread with different subject line.   Let's try to keep this thread to the subject it's under ... Messaging system not loading/working for some users

'SoS', Ken


In reply to Ken Task

Re: Messaging system not loading/working for some users

by Will B -

Ken,

I went from 3.4 to 4.0. I've done bigger jumps than this in the past though without any issues.

The screenshots are just to highlight an underlying database connectivity issue. It all seems relative. The messaging system isn't working as expected because of an apparent database connectivity issue which also seems to be a connected issue with other types of functionality in the file picker etc. But yes, the file picker issue isn't the issue here, the messaging is.

See additional screenshots for messaging. 

1) the log in and open messages, doesn't load (takes minutes to load)

2) even settings functionality is not available whislt this loads

3) after 1-2 minutes messages load


Attachment messaging1.PNG
Attachment messaging2.PNG
Attachment messaging3.PNG
In reply to Will B

Re: Messaging system not loading/working for some users

by Ken Task -
Picture of Particularly helpful Moodlers

@Will

https://docs.moodle.org/400/en/Upgrading
Notes:
You can only upgrade to Moodle 4.0 from Moodle 3.6 or later. If upgrading from earlier versions, you must upgrade to 3.6 as a first step.

So in your case, both messages and filepicker issues might be related in that you did 3.4 to 4.0.

Screen shots on messages don't show anything of an error and look similar to mine or the messages interface on this system.

Slowness ... 1-2 minutes to load ... Uhhh ... nothing will ever be instant ... however, that isn't my experience on a server running 3.9.highest - didn't time it.   Have observed it appears to load in bunches ... 20 or so first, then as I scroll down, a pause and another loading of the next X number of messages - not instant - but not 1-2 minutes either!

So @Will - what are settings of PHP in new environment.

php -v

php -i |grep time

max_execution_time
max_input_time

Also other .. like memory a script can consume, max memory a script can use.

Any errors in your error log for apache?

What does your web service access log look like for core_message:

cat /var/log/httpd/ssl_access_log |grep core_message

such a query on the ssl access log returns something like:

MYIP - - [04/Jul/2022:08:29:37 -0500] "GET /lib/ajax/service-nologin.php?info=core_output_load_template_with_dependencies&cachekey=1656004553&args=%5B%7B%22index%22%3A0%2C%22methodname%22%3A%22core_output_load_template_with_dependencies%22%2C%22args%22%3A%7B%22component%22%3A%22core_message%22%2C%22template%22%3A%22message_drawer_conversations_list_items_placeholder%22%2C%22themename%22%3A%22boost%22%2C%22lang%22%3A%22en_us%22%7D%7D%5D HTTP/1.1" 200 1109

Using Boost theme.

What does your look like?

In ssl_error_log, nothing:

cat /var/log/httpd/ssl_error_log |grep core_message

'SoS', Ken

In reply to Ken Task

Re: Messaging system not loading/working for some users

by Will B -

Ken,

I'll correct myself. I did go from 3.4 to 3.6 first, followed the correct path. I just wasn't operating on 3.6 as I went to 4.0 straight away so the LMS was never actually "live" with 3.6.

I did try testing in just Boost and the same happened, as I thought it may be a theme issue.

I'm on PHP 7.3.33

max_execution_time 300

max_input_time 300

memory limit 2048m

Thanks

Will

In reply to Will B

Re: Messaging system not loading/working for some users

by Ken Task -
Picture of Particularly helpful Moodlers

@Will - others excluded ...

1-2 minutes = 60 seconds - 120 seconds .... SECONDS!  What is expectation?  *Instant* will never be achieved.

Tuner - is not something one runs one time and then never again, but on a regular basis.   Didn't you say at one time you optimized the entire DB?   Tables can and do reach a condition where they need optimization.

You also mentioned DB errors but didn't say what those were.

And, some users ... what roles - teachers/admins of site?  The more responsibility in a site, the heavier queries are for role abilities/permissions/etc.   Admin level users will probably be slower.

At the top of tuner run - am showing mine ... yours may/may not have same but:

[!!] /var/log/mysqld.log contains 131 warning(s).
[!!] /var/log/mysqld.log contains 15 error(s)

cat /var/log/mysqld.log |grep error

That shows only 15 and look like:

2020-07-30T03:57:06.999927Z 10979 [Note] Aborted connection 10979 to db: 'moodle' user: 'root' host: 'localhost' (Got an error reading communication packets)

About those:

https://www.percona.com/blog/2016/05/16/mysql-got-an-error-reading-communication-packet-errors/

There are too many suggestions on the above page for me to post here.

But, am gonna (for now) chaulk them up as a 'hickup' ... I'll watch that they don't become the norm but for right now my plan is ... do nothing! smile

Back to tuner ouput:

[OK] Total fragmented tables: 0
[OK] Slow queries: 0% (0/11M)
[OK] Aborted connections: 0.00%  (0/13458)
[OK] InnoDB buffer pool / data size: 4.0G/3.6G
[OK] InnoDB buffer pool instances: 4

What about yours?

In variables to adjust???  I have none that I *need* to tweak at present.

If there are fragmented tables, tuner will have in suggestions the command to use from mysql client to fix.

So solution for you @Will .... I dunno!   Keep digging but know that there is no such thing as 'instant' - and 60-120 *seconds* ... you might have to 'live with'! smile

'SoS', Ken


In reply to Will B

Re: Messaging system not loading/working for some users

by Ken Task -
Picture of Particularly helpful Moodlers

@Will ... observation ...

In this forum/system (running version 4 now), messages, I have 528 in Private.

But it limits to displaying 4 in an index type display ... and when clicking 'see all' I get only 7.

Gear icon ... which is config/preferences ... has no item for number to display.

See attached screen shots.

@Will - What do you observe on your system?

'SoS', Ken

Attachment Screen Shot 2022-07-04 at 8.00.41 AM.png
Attachment Screen Shot 2022-07-04 at 8.01.30 AM.png
In reply to Ken Task

Re: Messaging system not loading/working for some users

by Ian L -
As an admin and teacher in the course I have been using the messaging in the profile area to respond and give feedback to the students so you are saying change this to delete them more urgently? Didn't know they were getting deleted at all, not sure I want to do that, when you comment on their assignments they don't get a notification which is no good.

Here are the current Messaging settings:
message settings
In reply to Ken Task

Re: Messaging system not loading/working for some users

by Ian L -
PS that screenshot above is not mine.
In reply to Felipe Almeida de Souza

Re: Messaging system not loading/working for some users

by Ian L -
Me too. Did you figure out?