Help - (Run Report Generation Scheduled Tasks) failed in CRON run

hello guys , please help me troubleshoot this error

(Run Report Generation Scheduled Tasks) failed in CRON run

this the result after running command: sudo -u www-data php -f cron.php

PHP Notice:  Trying to get property 'hour' of non-object in /var/www/suitecrm/modules/Schedulers/Scheduler.php on line 452
PHP Notice:  Trying to get property 'min' of non-object in /var/www/suitecrm/modules/Schedulers/Scheduler.php on line 452
PHP Fatal error:  Uncaught TypeError: Argument 1 passed to AOR_Scheduled_Reports::handleTimeZone() must be an instance of DateTime, boolean given, called in /var/www/suitecrm/modules/AOR_Scheduled_Reports/AOR_Scheduled_Reports.php on line 195 and defined in /var/www/suitecrm/modules/AOR_Scheduled_Reports/AOR_Scheduled_Reports.php:204
Stack trace:
#0 /var/www/suitecrm/modules/AOR_Scheduled_Reports/AOR_Scheduled_Reports.php(195): AOR_Scheduled_Reports->handleTimeZone(false)
#1 /var/www/suitecrm/modules/Schedulers/_AddJobsHere.php(786): AOR_Scheduled_Reports->shouldRun(Object(DateTime))
#2 /var/www/suitecrm/modules/SchedulersJobs/SchedulersJob.php(540): aorRunScheduledReports(Object(SchedulersJob))
#3 /var/www/suitecrm/include/SugarQueue/SugarCronJobs.php(191): SchedulersJob->runJob()
#4 /var/www/suitecrm/include/SugarQueue/SugarCronJobs.php(231): SugarCronJobs->executeJob(Object(SchedulersJob))
#5 /var/www/suitecrm/cron.php(100): SugarCronJobs->runCycle()
#6 {main}
  thrown in /var/www/suitecrm/modules/AOR_Scheduled_Reports/AOR_Scheduled_Reports.php on line 204

i also tried to add time zone to /cli/php.ini & /apache2/php.ini
and done alsop this https://pgorod.github.io/Reindex-AOD/

realy need your help

2 Likes

so yesterday in assigned the new report from admin to one of the users
today i received to my email the new schedule report that never run before today
and now when i run sudo -u www-data php -f cron.php
i get :
PHP Notice: Trying to get property 'hour' of non-object in /var/www/septiercrm/modules/Schedulers/Scheduler.php on line 452 PHP Notice: Trying to get property 'min' of non-object in /var/www/septiercrm/modules/Schedulers/Scheduler.php on line 452

i dont have a clue about the error or why it worked today …

So now you are getting the schedule report email? and the only problem is the PHP Notice?

Please check the interval hour, minute at which the scheduler would get executed “Run Report Generation Scheduled Tasks”

for your first question i will answer no problem now but im trying to understand what was the problem
for your second question im attaching screenshot

same error on my installation.
PHP Fatal error: Uncaught TypeError: Argument 1 passed to AOR_Scheduled_Reports.

Windows Server
Suite CRM Version 7.11.13 - Sugar Version 6.5.25 (Build 344)
PHP Version 7.3.17
Apache/2.4.43 (Win64) OpenSSL/1.1.1f PHP/7.3.17

date.timezone = “Europe/Athens”

I Scheduled a report to be sent by email daily at 11.15 . when cron runs, I get the fatal error.
I have in php log file :
[24-Apr-2020 11:22:41 Europe/Athens] PHP Fatal error: Uncaught TypeError: Argument 1 passed to AOR_Scheduled_Reports::handleTimeZone() must be an instance of DateTime, bool given, called in C:\web\Apache24\htdocs\modules\AOR_Scheduled_Reports\AOR_Scheduled_Reports.php on line 195 and defined in C:\web\Apache24\htdocs\modules\AOR_Scheduled_Reports\AOR_Scheduled_Reports.php:204
Stack trace:
#0 C:\web\Apache24\htdocs\modules\AOR_Scheduled_Reports\AOR_Scheduled_Reports.php(195): AOR_Scheduled_Reports->handleTimeZone(false)
#1 C:\web\Apache24\htdocs\modules\Schedulers_AddJobsHere.php(786): AOR_Scheduled_Reports->shouldRun(Object(DateTime))
#2 C:\web\Apache24\htdocs\modules\SchedulersJobs\SchedulersJob.php(540): aorRunScheduledReports(Object(SchedulersJob))
#3 C:\web\Apache24\htdocs\include\SugarQueue\SugarCronJobs.php(191): SchedulersJob->runJob()
#4 C:\web\Apache24\htdocs\include\SugarQueue\SugarCronJobs.php(231): SugarCronJobs->executeJob(Object(SchedulersJob))
#5 C:\web\Apache24\htdocs\cron.php(100): SugarCronJobs->runCycle()
#6 {main}
thrown in C:\web\Apache24\htdocs\modules\AOR_Scheduled_Reports\AOR_Scheduled_Reports.php on line 204

Default value , is As often as possible. the value is Every 1 minute.

That error is related to the last_run value.

In Admin / Schedulers, in that job, what does it say in “Last ran successfully” field? Is it in the correct timezone?

And in the database, schedulers table, what do you see in last_run? The timezone should be normalized to GMT there.

I have a null value in the database.
On the form it is empty, I just created it.

Can you please open a new issue for this on GitHub? Include your stack trace, the information about the database value, and a reference to this PR which introduced the bug:

2 Likes

Thank you for reporting.

Here is the link to your issue, for reference:

2 Likes

Same issue for me
CentOS 8.1 - php 7.3.16 - 10.3.17-MariaDB - mysqlnd 5.0.12 - SuiteCRM 7.11.13 clean install

Time zone is Europe/Berlin and lastRun is not null, schedulers are running properly but scheduled reports are not generated. Scheduler task is not running successfully after I have defined report scheduling for some reports, added to https://github.com/salesagility/SuiteCRM/issues/8676

I also have the same problem since almost a year and it made me to have real nightmares about it. So, I made an copy of my SuiteCRM at my hosting (I use Godaddy) to test all the posible solutions, until I get to this post and I was able to run scheduled reports. :v:

First things first:
Suite CRM Versión 7.11.13
Sugar Versión 6.5.25 (Compilación 344)
PHP Version 7.4
Hosting Godady, Linux Server / Apache 2.4.41 / PHP 5.6.40


Step 1, added the comand line at my hosting cronjob, just like is indicated on Schedulers

          • cd /home/**myhost**/public_html/crm; php -f cron.php > /dev/null 2>&1
            

Step 2, on cron.php file, I made a coment on lines 50 to 53, like this, to disable CLI

////$sapi_type = php_sapi_name();
//if (substr($sapi_type, 0, 3) != ‘cli’) {
// sugar_die(“cron.php is CLI only.”);
//}

Step 3, changed the Default value , is As often as possible. the value is Every 1 minute, on “Run Report Generation Scheduled Tasks” (thank you, dhaivatnaik :fist_right: :fist_left:)

Step 4, I was set my users date/time at Admin / User / Advanced to (UTC GMT +0:00).

Step 5, scheduled the report, considering de time zone GMT+0:00 to set the desired time (I’m in PY, so we have -4:00 hours).

Step 5, Rebuild and Repair (just in case :smiley: )

It worked! I made a test with e-mail to a user and an external e-mail address and both was successfully arrived.

I also made another test, changing back my user’s time zone to the real one (GMT - 04:00), and it has stopped working.

Then I tryed to do the same on my “real” Suite CRM, and it worked too. :raised_hands:. It’s awfull to have 4 hours of difference all across my Suite CRM and I’ll need to pay a lot of attention to do not made bad mistakes on my daily work, but it’s better than to manually run all the reports and send it to the users every single day.

I hope that together we can find a solution to the user’s time zone issue, as soon as it´s possible.

**Face Same error someone please help

Notice: Trying to get property ‘hour’ of non-object in C:\xampp\htdocs\SuiteCRM-7.12.7\modules\Schedulers\Scheduler.php on line 453
PHP Notice: Trying to get property ‘min’ of non-object in C:\xampp\htdocs\SuiteCRM-7.12.7\modules\Schedulers\Scheduler.php on line 453

How you resolve this issue ,i am also facing this one

Notice: Trying to get property ‘hour’ of non-object in C:\xampp\htdocs\SuiteCRM-7.12.7\modules\Schedulers\Scheduler.php on line 453
PHP Notice: Trying to get property ‘min’ of non-object in C:\xampp\htdocs\SuiteCRM-7.12.7\modules\Schedulers\Scheduler.php on line 453