Sched Task Failure - Daily Digest Notifications - Errors in Subs-Post.php

Started by North East Man, December 15, 2018, 11:13:51 AM

Previous topic - Next topic

North East Man

Running SMF 2.0.15

There appears to be an error with the daily sending of the notifications digest.  It is not sending automatically and only works intermittently if I click on the run now manual option.  I am seeing these 4 errors repeatedly in the error log - hundreds and hundreds of times.

Quote
[15-Dec-2018 08:00:05 Europe/London] PHP Notice:  Undefined index: server in /home/xxxx/xxxx.co.uk/Sources/Subs-Post.php on line 627
[15-Dec-2018 08:00:05 Europe/London] PHP Notice:  Undefined index: utf8 in /home/xxxx/xxxx.co.uk/Sources/Subs-Post.php on line 1262
[15-Dec-2018 08:00:05 Europe/London] PHP Notice:  Undefined index: utf8 in /home/xxxx/xxxx.co.uk/Sources/Subs-Post.php on line 1264
[15-Dec-2018 08:00:05 Europe/London] PHP Notice:  Undefined index: utf8 in /home/xxxx/xxxx.co.uk/Sources/Subs-Post.php on line 1237

Line 627 of Subs-Post shows:
Quote$line_break = $context['server']['is_windows'] || !$use_sendmail ? "\r\n" : "\n";

Line 1262 Shows:
Quoteif ($hotmail_fix && ($context['utf8'] || function_exists('iconv') || $context['character_set'] === 'ISO-8859-1'))

Line 1264 shows:
Quoteif (!$context['utf8'] && function_exists('iconv'))

Line 1237 shows:
Quoteif (!$context['utf8'] && function_exists('iconv'))

I can see that two different character sets are being referenced.  Is this the cause of the failure to send the digests?  Is there anything I can do about it?  It was one of the most used features on the site the forum was previously run from.

Illori


Arantor

Do you have regular visitors coming to the site? Scheduled tasks don't happen just magically, you have to have visitors coming to the site regularly to trigger things running in the background.

North East Man

We have 2 thousand members who have all signed up in the last 3 weeks since go live so activity on the site is not an issue.  There are a minimum of a couple of hundred posts per day with users around the world so usage is 24 hours.

So, if it is a known issue with no fix, the forum will never be able to issue daily notifications- is that the final answer?  That is disappointing to hear.

I take it then that switching from PHPmail to SMTP would make no difference.

shawnb61

These messages normally do not prevent normal operation of the scheduled tasks.  If you can't get notifications out the door at all, then this is something new. 

Do you get errors when you attempt to run the notification manually? 
Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

North East Man

No,

When I saw that the 8am Run hadn't worked, I pressed the Run Now button, but nothing happened.  Pressed again, waited, nothing happened.  On the third press, the queue jumped into life and emails started going out.  But there were no error messages after the 08.00.05 shown in the log. So first two presses of Run Now, nothing happened and no errors, third time worked and still no errors.

Immediate notifications of emails, PMs and topic notifications are working and not producing an error.  Just the scheduled task is not working.

shawnb61

OK, so the good news is that it works.   

Those 'undefined index' notes in the error log can be safely ignored.  Yes, a bug.  They happen sometimes when auto tasks are triggered by bots.  But they do not prevent proper notifications from being sent. 

SMF keeps track of a bunch of things, such as, who wants which notifications, when they were last sent, when scheduled tasks were run, when they should be run NEXT, etc., etc...   All in order to avoid double-sending things & spamming folks.  Many folks ask for weekly notifications, not daily, to avoid spamming themselves.  It's not uncommon for no dailies to go out. 

E.g., since you just sent one, don't be surprised if there are none (or very few) during the next scheduled daily execution. 

Finally, they're asynchronous.  They don't run proactively when scheduled, because there's no real scheduler...  They run when some user activity takes place & triggers them.  Usually within minutes of when they're scheduled.  I.e., be patient. 

So... 

Monitor your scheduled task log.  If it says it's running, it's running.  For the reasons noted above, it may be 1.5-2 days before your next set of emails go out... 

& ignore those messages in that error log. 
Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

North East Man

Thanks for that really helpful reply.  As you say I'll keep an eye on the log for the next couple of days.  I've signed up to the daily digest myself on the busiest of the boards so I'll see if I get one and when.

As a matter of interest, what sort of user activity might trigger the tasks.  Obviously, just users on the site doesn't do anything.  Does viewing posts trigger it or does it have to be something like making a post?


shawnb61

Quote from: North East Man on December 15, 2018, 04:19:55 PM
Obviously, just users on the site doesn't do anything.

Actually, yes, a quick check is done under most page loads. 

The code tries to leverage bot hits (look for AutoTask in Load.php).  For some reason, estimating time of death via maggots on a carcass comes to mind...  Distasteful, but reliable.  You know it's gonna happen, so use it. 

Sorry for the macabre metaphor, but it's the closest one to the truth I can think of...
Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

Advertisement: