Advertisement:

Author Topic: Sched Task Failure - Daily Digest Notifications - Errors in Subs-Post.php  (Read 484 times)

Offline North East Man

  • Semi-Newbie
  • *
  • Posts: 32
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:
Quote
   if ($hotmail_fix && ($context['utf8'] || function_exists('iconv') || $context['character_set'] === 'ISO-8859-1'))

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

Line 1237 shows:
Quote
   if (!$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.

Offline Illori

  • Project Manager
  • SMF Legend
  • *
  • Posts: 51,573
Re: Sched Task Failure - Daily Digest Notifications - Errors in Subs-Post.php
« Reply #1 on: December 15, 2018, 12:20:43 PM »
it is a known issue with no known fix.

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,982
    • StoryBB/StoryBB on GitHub
Re: Sched Task Failure - Daily Digest Notifications - Errors in Subs-Post.php
« Reply #2 on: December 15, 2018, 12:24:47 PM »
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.
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline North East Man

  • Semi-Newbie
  • *
  • Posts: 32
Re: Sched Task Failure - Daily Digest Notifications - Errors in Subs-Post.php
« Reply #3 on: December 15, 2018, 12:34:58 PM »
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.

Offline shawnb61

  • Developer
  • SMF Hero
  • *
  • Posts: 1,579
    • sbulen on GitHub
Re: Sched Task Failure - Daily Digest Notifications - Errors in Subs-Post.php
« Reply #4 on: December 15, 2018, 01:41:43 PM »
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

Offline North East Man

  • Semi-Newbie
  • *
  • Posts: 32
Re: Sched Task Failure - Daily Digest Notifications - Errors in Subs-Post.php
« Reply #5 on: December 15, 2018, 01:53:29 PM »
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.

Offline shawnb61

  • Developer
  • SMF Hero
  • *
  • Posts: 1,579
    • sbulen on GitHub
Re: Sched Task Failure - Daily Digest Notifications - Errors in Subs-Post.php
« Reply #6 on: December 15, 2018, 03:05:08 PM »
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

Offline North East Man

  • Semi-Newbie
  • *
  • Posts: 32
Re: Sched Task Failure - Daily Digest Notifications - Errors in Subs-Post.php
« Reply #7 on: December 15, 2018, 04:19:55 PM »
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?


Offline shawnb61

  • Developer
  • SMF Hero
  • *
  • Posts: 1,579
    • sbulen on GitHub
Re: Sched Task Failure - Daily Digest Notifications - Errors in Subs-Post.php
« Reply #8 on: December 15, 2018, 04:41:17 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