Daily digests aren't going out daily

Daily digests aren't going out daily

by N Hansen -
Number of replies: 23
It was brought to my attention by one of my site users that he wasn't receiving daily digests in the last few days. In investigating this, I found some digests sent to a test account I have set up confirm this to some extent. For example, a digest was sent out on Dec. 13, which contains posts from Dec. 9, Dec. 11 and Dec. 13. I am running Moodle 1.5. Does anyone have any idea why this might be happening? Moreover, I thought cron was not allowed to send out posts that were more than two days old, does this not apply to digests as well? I've also noticed a few posts here and there don't get sent out when one is subscribed to individual emails.
Average of ratings: -
In reply to N Hansen

Re: Daily digests aren't going out daily

by N Hansen -
I went in the database and found a lot of messages in the forum queue dating back to Dec. 30. I can't figure out why they didn't go out though.
In reply to N Hansen

Re: Daily digests aren't going out daily

by N Hansen -
OK, I keep setting the digest sending time back by one hour and it sends some, but not all of the digests to people each time. There obviously is some sort of time out going on here and so I have reported this as bug 4532.
In reply to N Hansen

Re: Daily digests aren't going out daily

by Erik Ringmar -
Hi,

I have the same problem.  The digests are not digesting.  Grateful for any help.

cheers,

Erik
In reply to Erik Ringmar

Re: Daily digests aren't going out daily

by N Hansen -
I wish I could help you because that would mean I found a solution. Unfortunately, I got another complaint from a user about this today. Vote for this in the bug tracker if you are having the same problem as that way it might get the attention of the developers. I had my host change the cron slightly (after reading this http://moodle.org/mod/forum/discuss.php?d=28277&parent=133127), and while it still doesn't seem to be automatically sending out the digests when it should, I am finding that if I repeatedly visit cron.php in the minutes after the hour it is supposed to run, it eventually spits out the digests. But this isn't how it is supposed to work. I shouldn't have to go to cron.php myself. The other strange thing about it is while it is supposed to send them on the first time cron is run after the hour has passed, it doesn't do that. I set it to run at 7pm. After 7pm had passed, I visited the cron.php multiple times, it wasn't until I had visited it 4 or 5 times 54 seconds after 7 that it bothered to spit out the digests. Why didn't it do that from the first time it was run? I don't know what's going on. It definitely is not the cron function on the server, it has something to do with Moodle itself. Does anyone know if there is some sort of time out built into Moodle?

What's worse is when I thought it was actually sending them when they disappeared from the database, they weren't being sent, they simply were getting deleted.

I've had problems time to time with individual messages disappearing, but in general Moodle's cron seems to work for the individual messages, just not the digest.
In reply to N Hansen

Re: Daily digests aren't going out daily

by N Hansen -
I'm relying simply on intuition here, but I may have located the possible problem and will test it today. In looking at my database in phpmyadmin, I noticed that the forum_queue table had a relatively large amount of overhead. Now from what I understand, overhead is due to tables where a lot of deletion goes on (as would happen in this particular table as records are sent out) and when the table is fragmented. Knowing that fragmentation can slow a system down, I'm assuming that the decreased speed of accessing the table might have led to the process of sending out the queued digests timing out, I decided to optimize the table and I will see if that has any effect today and let you know. Like I said, I'm simply operating here on what seems to me to be logic, without knowing whether this really has anything to do with it at all.

But of all the tables in my database, the one with a HUGE overhead was the quiz questions table... 
In reply to N Hansen

Re: Daily digests aren't going out daily

by N Hansen -
OK, optimization had no helpful effect. So I forced out the unsent messages as described above so that there were no outstanding messages, deleted the entire table, and created a new one. Just ran a test (albeit with only one message to one recipient) and it worked by itself. I think perhaps the table had gotten corrupted in some way so I figured it was better to just start over from scratch with a clean new one.
In reply to N Hansen

Re: Daily digests aren't going out daily (still talking to myself)

by N Hansen -
Well, I'm continuing this dialog with me, myself and I in hope that someone else will read this and be able to help me. All of the above things have not helped. What is going on is that cron is working on my server, it is calling cron.php, and it in turn is calling the forum/lib.php file that contains the instructions to send out the digest. That file in turn is accessing the forum_digest table in the database. All is good to this point...but when it accesses the table it is usually not sending out everyone's digests. It sometimes sends out no digests, more often just one person's digests, and sometimes more than one person's. Rarely does it send out everything. I am continuing to reset my digest sending time back by one hour over and over to flush the messages out, but this is not really acceptable in the long run. Obviously, there is something that is causing cron to continue on without finishing its job on this table. I do not know how long this has been going on, but the problems date back at least until Dec. 9. I'm running Moodle 1.5. I'm stumped with this. I've done all the troubleshooting I can possibly do at this point and now am at the mercy of you kind Moodlers who know more about this than I do.
In reply to N Hansen

Re: Daily digests aren't going out daily (still talking to myself)

by Mary Kaplan -
Hi, N Hansen!
Just wanted to send a note to let you know you are not alone. I haven't been to moodle.org for a while, so I hadn't seen your thread. I am having the same problem. Didn't want you to think you were alone! But I am a simple user, and not one of those kind souls "who know more about it than you do". Sorry I can't help. I tried changing forums to "everyone is subscribed", but that didn't help either. sad

It is sort of interesting that some people are getting e-mail and some are not. My husband's is working, but mine is not. mixed

--Mary
In reply to Mary Kaplan

Re: Daily digests aren't going out daily (still talking to myself)

by N Hansen -
While it has only been a couple days now, I think I have found the solution as the digest has gone out now properly for two or three days with the new setting. The thing I did was dropped the wget command for cron and replaced it with a simple:

php http://www.mysite.com/admin/cron.php

As someone had suggested elsewhere in the forums here. It seems to have solved the problem

But if your problem is a matter of some people getting individual messages and others not on a regular basis, I would suspect that perhaps you have a spam filter on an email account that is trapping the messages. As soon as I got cron working properly again on my site, I lost the digest that allegedly had been sent! I was using a gmail account and found it had been sent to the spam box!
In reply to N Hansen

Re: Daily digests aren't going out daily (still talking to myself)

by Barry Lindler -
This may be a dumb question, but I'm using a shared hosting environment, pre-installed with Moodle 1.5.2, and it has a cpanel cron.  Is wget something built into Moodle that I should disable?  Or how would I go about utilizing the suggestion of not using wget?  I'm having the same problems as listed above.


In reply to Barry Lindler

Re: Daily digests aren't going out daily (still talking to myself)

by N Hansen -
In Cpanel there is an icon that says cron jobs that allows you to edit the cron. Just go in and  select standard replace the line that contains wget and some other text along with your url of cron with the word "php" followed by a space and then followed by the full path to your cron file.
In reply to N Hansen

Re: Daily digests aren't going out daily (still talking to myself)

by Andy Hawkins -

All this sounds very like problems we are experiencing. (Moodle 1.5.3+, w2K IIS)

Changed digest time and ran cron manually from url - pile of digests went out (but not all) - probably until script timeout mentioned elsewhere.

Changed again (was doing this around 6pm) and repeated the process.

From then on - no luck - tried changing digest time back - but cron would not play ball - as if it knew it had already been run. It would seem I would have to wait until next hour to run it again. Not very convenient as we have thousands in the forum queue table that I would like to flush out.

Do not have access to server at present - when I do I will have to increase script timeout temporarily to large value and run it again.

Question - each time cron run from url it kicks user off the system - should this be a worry if as claimed anyone can run it even on other people's moodle? Hopefully we have missed something, or it only affects the user/ip where the cron is run from (cannot test this fom home)

TIA

Andy

In reply to Andy Hawkins

Re: Daily digests aren't going out daily (still talking to myself)

by N Hansen -
Yes, it does kick you out when you run it manually. Don't know why though. However, I found in the end that changing cron to this solved the problem and it has been running smoothly ever since:

php http://example.com/moodle/admin/cron.php

In reply to Andy Hawkins

Re: Daily digests aren't going out daily (still talking to myself)

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Yes, the trashing of the user session is intentional (for security).

I don't know why you'd be getting different behaviour from the external wget/manual method vs the internal php method. It's the same script. mixed
In reply to Martin Dougiamas

Re: Daily digests aren't going out daily (still talking to myself)

by Michael Penney -
One of my server admins turned off wget a while back, and of course negleted to tell me until after a few days I noticed the problem and switched cron over to php cli.

Perhaps wget is being timed out or blocked in some shared environments?


In reply to Martin Dougiamas

Re: Daily digests aren't going out daily (still talking to myself)

by Scott Elliott -
Funny thing, I was having problems getting a large course to complete the backup process through cron.  I changed the wget method to calling the script with php command and I haven't had a problem since.

Maybe there's some timeout issues with going through httpd (I'm assuming that's the big difference between using wget and using php directly).
In reply to N Hansen

Re: Daily digests aren't going out daily

by Andrew Steele -
We have a similar issue with at least one of our clients using Moodle.  It is possible that other clients also have problems but few users have opted for digest deliveries.

The most recent report of a problem noted:  "Yesterday, (18th) I received a Moodle digest with my posts of Jan 12th and then other's posts from Jan 16 and 17."

The only change we've noticed that seems, possibly, to immediately precede the appearance of the erratic delivery of digests was the installation of the recent security update to version 1.5.3+

Andrew

In reply to N Hansen

Re: Daily digests aren't going out daily

by Bill Burgos -
Hi Nicole,

I don't know how much mileage this will get you, but this is what we were experiencing on our servers.

It seems that the forum digest cron takes a bit of time to complete. If you can check your phpinfo.php from the Admin page, you can look for the:

max_execution_time =

parameter. If it is at the default 30 seconds, you might be getting a timeout on the sending of the digests.

One way to make sure is to get the output of every cron execution on the installation. This will depend on how you can set the crontab and will require a bit of research on how to get your hosting service to send you the output of each cron execution.

If you have the cron set for every 15 minutes, you will get about 96 messages per day!. However, it will be worth having a day or two of logs to check. A successful script will have this message:

<snip>
Processing email digest for user 217... success.
Email digests successfully sent to 68 users.
done.

<snip>
I use a filtering on the email client (Thunderbird) to let me know when a script has sent a digest and if it was not successful.

If you see that it is timing out before all messages are sent, then you can do or one or both of two things:

1. Try to set the:

max_execution_time =

to a higher number. This, you might get your hosting provider to do it in php.ini or try to do this in the .htaccess file.

2. Set the digest sending time to an obscure time (2:00am?) when you anticipate that the server is not as busy.

As you are sharing your installation with other users on the same server, it would be more of a hit or miss on getting the timing right.

Monitoring the cron output  will give you a better idea.

HTH,

Bill
In reply to N Hansen

Re: Daily digests aren't going out daily

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
I think this is fixed now, see bug 4532.
In reply to Martin Dougiamas

Re: Daily digests aren't going out daily

by Anil Sharma -

OK I am facing similar and more problems with 1.6.

Cron works when it is called using

php http://www.mysite.com/admin/cron.php

instead of wget.  Emails are also sent automatically.  My cron is setup for 15 minutes, and every 15 minutes, mails are sent. 

However, the cron run after the email Digest time, runs successfully without sending the forum digest mails.  It does not send the forum digest mails until and unless you call the cron.php file manually.  I have changed the max_execution_time = to 2000, even though my longest cron.php call is 350 secs.  During the manual call of cron.php, there is no problem at all and all mails are sent out !

In reply to Anil Sharma

Re: Daily digests aren't going out daily

by Anil Sharma -

I've done some more tests on cron in moodle 1.6  and have reached this conclusion :

1.  using php instead of wget to run the cron doesnt send out the Forum Digest emails - only. All other cron functions work.

2. using wget (GET) to call cron automatically works fine with 1.5 but not with 1.6.  This has nothing to do with the versions of PHP and i have tested that.

3. If you use wget manually to run cron, you get logged out. While Martin calls that a security feature, I dont know if thats how it should be.

4.  There is no way to automatically send out forum digest as of now ??

In reply to Anil Sharma

Re: Daily digests aren't going out daily

by N Hansen -
When I was runnning 1.5, I had problems with digests using wget, and then I switched to php and the problem stopped, and it has not happened again at all in 1.6. I wish you the best of luck with solving your problem though-I know I was going crazy over the digests not going out when it happened to me.