Multiple email messages - Moodle 3.7 - mdl_notifications

Re: Duplicate forum notification emails being sent - Moodle 3.7.1

by Paulo Cerqueira -
Number of replies: 11
An important update about this bug - I think it is (I don't know why) related with the server LOCALE. My problems started AFTER I changed the LOCALE to pt_BR. Before, everything was working fine, then the duplicated messages began. Well, I decide to rollback the LOCALE. Guess what ? No more duplicates and database error !

I just can´t understand what the LOCALE has to do with this issue, but it's related. No problem with en_US.UTF-8 UTF-8.
Average of ratings: Useful (3)
In reply to Paulo Cerqueira

Re: Duplicate forum notification emails being sent - Moodle 3.7.1

by Camilo Ravelo Durán -
hi, where specifically do i make the change? I have the same problem. thank you
In reply to Paulo Cerqueira

Re: Duplicate forum notification emails being sent - Moodle 3.7.1

by Erick de Azevedo Lima -

Hello everyone!

Yesterday I've updated the bug MDL-66561 with some additional info I found when debugging. And yes, the locale causes the trouble. I've tracked the problem and found that it is located in the Moodle MySQL database component that performs an ugly hack when building the database query (it is documented in the code as an ugly hack, these are not my words). It converts a floating point numbers (in this particular case, the timestart and timeend fields are the culprits) to string. When doing so, the PHP internal engine uses the locale to perform the conversion and... it exchanges the decimal separator dot (.) for comma (because here in Brazil we use comma as the decimal separator), making the MySQL think that the decimal part of the number is another value. In this case, the database query end up with 12 values x 10 database columns and does not know what to do, throwing an error. This bug will only occur when the decimal separator is other than dot, because MySQL only accepts dot as decimal separator in raw database queries. I've suggested where the Moodle devs can make the correction, because I don't know the worflow for contributing with a source code change. Anyway, now we do know a root cause for this problem and the suggested workaround is all we can do while waiting for a patch. Sorry for all the tech talk, but I could not find better words to explain. If there are any additional doubts, just let me know.

Average of ratings: Useful (3)
In reply to Erick de Azevedo Lima

Re: Duplicate forum notification emails being sent - Moodle 3.7.1

by Brian Caballero -

Hi @Erick,

I had the same issue with multiple notifications.  I checked this thread and followed the fix on LOCALE settings.   I changed it from `C.UTF-8` to `en_US.UTF-8"`.  But I'm still having same issues.  What other server configs do I need to change? Thank you.

In reply to Brian Caballero

Re: Duplicate forum notification emails being sent - Moodle 3.7.1

by Erick de Azevedo Lima -
Hello, Brian. Sorry for the delay in my response. I got a lot of e-mails and the one containing the notification from your post just "got buried" in my mailbox. I only noticed your mention reading the post here in the moodle.org site. In fact, I could not change server settings for my Moodle sites. What I've done in each one of them was disabling the logging for tasks. The error occurs during the log operation, so I disabled this task logging it and will keep it disable until the Moodle team apply a patch correcting the real bug, that is on the database layer and not on logging/task. I documented a patch on the bug tracker on January 14th, because the bug is known and already had a "bug number", but, until this moment, I had no reply at all . And the saddest part is: Even it is a little piece of code, I think the patch will take a long time until it gets applied to stable Moodle, because this bug only affects sites from that uses locales that does not use the dot(.) as a decimal separator. Sad, but there's nothing more I can do.
Average of ratings: Useful (1)
In reply to Erick de Azevedo Lima

Re: Duplicate forum notification emails being sent - Moodle 3.7.1

by Brian Caballero -
Thank you for the response Erick. Another thing i noticed related to the issue might be our Load Balancing. Locally I manage to replicate the multiple notification issue by executing two or more cron at the same time. The result depends on the number of subscribers within the forum.

On our case, all of our front-end executes cron. There are chances that two or more process run at the same time thus causing this error. This now leads me to question this part of moodle doc recommendation:
https://docs.moodle.org/310/en/Cron#Running_cron_for_several_Moodle_servers

I'm now trying to look into this ticket for more info on how to set up a dedicated cron server for Moodle:
https://moodle.org/mod/forum/discuss.php?d=127108
In reply to Brian Caballero

Re: Duplicate forum notification emails being sent - Moodle 3.7.1

by Camilo Ravelo Durán -
Hello Brian,
I don't think it is the load balancer. I have the same problem in a moodle with a load balancer and another moodle without a load balancer.
In reply to Erick de Azevedo Lima

Re: Duplicate forum notification emails being sent - Moodle 3.7.1

by Camilo Ravelo Durán -
Thanks Erick for the answer, it's good to have an idea where the problem is coming from. In my case our moodle works with MICROSOFT SQL SERVER. I had not seen the comments because my solution was to block the emails in the forum activity, but I would like to activate them since they are useful. Unfortunately we do not have a solution for this problem.
In reply to Camilo Ravelo Durán

Re: Duplicate forum notification emails being sent - Moodle 3.7.1

by Anastasia Leyva -
Hi Camilo,

Have you found the solution to this issue? I am having the same problem with Moodle 3.9 and changing the LOCALE settings hasn’t fixed the issue. This is only happening for forum notifications no other emailing services (quickmail, open forum, messages…)
Any luck with this?
In reply to Anastasia Leyva

Re: Duplicate forum notification emails being sent - Moodle 3.7.1

by koen roggemans -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Translators
If you notice this but in Microsoft SQL server too, then it should be mentioned in the bug rapport MDL-66561 because there is nothing about MSSQL there yet, only Mysql.

As mentioned in the bug rapport: if you can't get it fixed, you can always switch off logging as a workaround on moodle/admin/settings.php?section=tasklogging
In reply to Anastasia Leyva

Re: Duplicate forum notification emails being sent - Moodle 3.7.1

by Camilo Ravelo Durán -
Hi Anastasia,

Unfortunately we still have not found a solution for the problem. We also have moodle 3.9 and we use sql server.