Warning [2]: Invalid argument supplied for foreach() in InboundEmail.php on line 1743

Upgraded from 7.7.8 to 7.8.6 I get error and my email job is not running well.
leaving many emails in inbox.

I must say that I have more than 10 emails accounts that I monitor (to create cases) and the process does not go all the way through all the accounts.
I get error from the job_queue table… using this query I can get the latest messages.

SELECT TOP 100 * FROM job_queue jq
WHERE jq.scheduler_id =
(SELECT id FROM schedulers s WHERE job LIKE ‘function::pollMonitoredInboxesAOP’ AND s.deleted=0 AND s.status= ‘active’)
ORDER BY jq.execute_time desc

BTW as a side note my scheduler date sorting is ackward, I am using the internationnal format yyyy-mm-dd, this is why I have to revert to sql query to get pulse of the situation.

And here is what I get in the log (crmlog)
09/19/17 13:32:58 [1320][1 ][FATAL] Job cb35c15b-70f7-430e-e8bb-59c152ec5f89 (!VaChercherCourrielCRM20170918) failed in CRON run

More data…
once the job started, from the query above the status is “running” the resolution is “queued” and message is null
then on the next time the job is called the message appear like :
“Warning [2]: Invalid argument supplied for foreach() in modules\InboundEmail\InboundEmail.php on line 3268
Warning [2]: Invalid argument supplied for foreach() in modules\InboundEmail\InboundEmail.php on line 3268
Warning [2]: Invalid argument supplied for foreach() in modules\Emails\Email.php on line 2143
Warning [2]: Invalid argument supplied for foreach() in modules\InboundEmail\InboundEmail.php on line 3268
Warning [2]: Invalid argument supplied for foreach() in modules\InboundEmail\InboundEmail.php on line 3268
Warning [2]: Invalid argument supplied for foreach() in modules\Emails\Email.php on line 2143
Warning [2]: Invalid argument supplied for foreach() in modules\InboundEmail\InboundEmail.php on line 3268
Warning [2]: Invalid argument supplied for foreach() in modules\InboundEmail\InboundEmail.php on line 3268
Warning [2]: Invalid argument supplied for foreach() in modules\Emails\Email.php on line 2143
Warning [2]: Invalid argument supplied for foreach() in modules\InboundEmail\InboundEmail.php on line 3268
Warning [2]: Invalid argument supplied for foreach() in modules\InboundEmail\InboundEmail.php on line 3268
Warning [2]: Invalid argument supplied for foreach() in modules\Emails\Email.php on line 2143
Warning [2]: Invalid argument supplied for foreach() in modules\InboundEmail\InboundEmail.php on line 1743
Warning [2]: Invalid argument supplied for foreach() in modules\InboundEmail\InboundEmail.php on line 1743
Unexpected failure, please check PHP logs and suitecrm.log”

I compared InboundEmail.php with a “fresh” one and they are similar, same for the .js counterpart…

my environment is Winsvr2008 R2 … IIS 7.x and MS sql on different server…

I’m not sure those warning are the real problem…

Could this be a matter of overgrown tables? Queries running too slow and timing out?

I recently blogged about all that, maybe that’s why it occurred to me…