Problem sending message to students

Problem sending message to students

Italo Vergara Colombo發表於
Number of replies: 7

Dear all,

I am currently using Moodle version 4.1.16, and when I try to send messages en masse to students (even with only 3 recipients), the system encounters a timeout and returns the following error: "undefined." However, the message is eventually delivered.

We have identified that the service being invoked and taking a long time to respond is:
core_message_send_instant_messages.

It should be noted that our architecture is deployed on AWS and consists of:

An application load balancer that exposes an EC2 instance on a private network.
The database hosted on another EC2 instance.
EFS for content storage.
Redis in Elasticache.

We would appreciate your help in identifying the cause of the problem and finding a solution to prevent the timeout when sending messages.

評比平均分數: -
In reply to Italo Vergara Colombo

Problem sending message to students

Ken Task發表於
Particularly helpful Moodlers的相片

Sounds like a large system ... most folks in these forums don't run large systems ... so some quick questions and suggestion as to where to look/check.

"An application load balancer that exposes an EC2 instance on a private network"

Does that mean multiple nodes in front of multiple EC2's or a single EC2? If latter, that has to be a pretty hefty EC2!

Sounds like an issue with cron job.   In the LB setup, is there one instance that runs moodle's cron job?

Sending of messages via SMTP server so check config/logs for that.

The traditonal suggestion would be to turn on debugging to see what moodle might report but with LB that could be on multiple instances ... and only one instance had the issue ... and only for a time.   So how about checking error logs?

'SoS', Ken

In reply to Ken Task

Problem sending message to students

Italo Vergara Colombo發表於
Dear Sir, thank you for responding. The truth is that we are just migrating, and I would like to tell you that it is a single EC2 and that we have also given the load balancer more time and the message arrives, but when sending the message to two users it takes around 5 minutes, which we believe is too long, but the error is no longer thrown, even so the wait is too long. Could you guide us on how to resolve this delay?
In reply to Italo Vergara Colombo

Problem sending message to students

Ken Task發表於
Particularly helpful Moodlers的相片

"we are just migrating" ... does that mean you have already or in the process of migrating to a Load Balanced system?

How many nodes do you have in the Load Balanced system?

If you have only one Moodle server, why do you need a Load Balanced system?

"when sending the message to two users it takes around 5 minutes,"

Moodle does NOT send messages right away ... a task that is part of the overall cron job does that.

If you set the path to php-cli in paths configuration, you can then go to the task list, find the task that sends messages, and click on the 'Run Now' link to see just that task execute.

Cron setup is outside of Moodle Admin GUI ... true server admin must do that.  The recommendation is to run the cron.php script once a minute.

I also asked about your SMTP setup .... that has to do with the sending of email.   Does your setup have an SMTP setup?

'SoS', Ken

In reply to Ken Task

Problem sending message to students

Italo Vergara Colombo發表於

Indeed, it has been migrated, and testing is underway to finally move it to production.

We work with more than one Moodle machine due to the number of people using the tool simultaneously, so we enabled more than one Moodle machine.

Additionally, in production, without migrating to this new configuration, with another provider, the task of sending a message to two people takes at most 30 seconds, and the same exercise we ran with our provider and its new configuration takes 5 minutes, as I mentioned. So I don't think it's a problem with the task execution or the cron job, which, by the way, runs every 2 minutes.

I hope you can help me.

In reply to Italo Vergara Colombo

Problem sending message to students

Ken Task發表於
Particularly helpful Moodlers的相片

Am trying to help, but you must check things suggested and share back findings - other wise, we are guessing and could be taking you down rabbit holes that lead nowhere!   Don't wanna do that!

Moodle isn't a mail server.  Without any SMTP configuration it will try to use Sendmail and uses PHPMailer to build messages.   Once a message is built and moodle tries to send, that's all that moodle can do.   The speed of delivery is now up to Internet ... number of devices (routers/switches/email gateways) that message has to go through to get to the destination.

And that's another factor ... student A uses @jaboynk.com for email.   Where on internet is that mail server?   2 hops away from your moodle?  or 20 hops away from your moodle?   UNKNOWN.

"the task of sending a message to two people takes at most 30 seconds"
That could be due to the SMTP setup is on the same network (fewer hops away from the moodle server) thus faster.

"its new configuration takes 5 minutes"
New server is on a different network.  Not using the same SMTP service/setup?.

I suggested you check SMTP setup.   Did you?

There is a plugin which might help
https://moodle.org/plugins/local_mailtest
Install the version that matches your core version.

The cron job/task, if delayed too long, gets qued up in adhoc_task thus the suggestion of setting the path to your php-cli so you could go to the task list and find the task for sending mail, and click the run now link to view how that mail is being processed locally.

With this issue, there is not ... and never will be ... one set of instructions to fix.   Too many factors to begin to guess.

'SoS', Ken

In reply to Ken Task

Problem sending message to students

Italo Vergara Colombo發表於
Dear Sir, I really appreciate your patience and your efforts in helping me find the solution. I've finally found the answer. It was that AWS was blocking the port, i.e., port 25. They consider it spam. I changed the port in Moodle's SMTP settings, and the messages are arriving quickly. Thank you very much.
評比平均分數:Useful (1)
In reply to Italo Vergara Colombo

Problem sending message to students

Ken Task發表於
Particularly helpful Moodlers的相片

Welcome!   Yep ... don't think any major provider allows port 25 in or out now.   No provider wants their systems to become the 'Spam King home' like the 'good old' AOL days.

'SoS', Ken