Cron.php isn't firing (or Schedulers aren't working)

Iā€™m trying to run the Google Calendar sync scheduler.

Iā€™m on a Windows shared hosting environment. Plesk is the admin portal. Iā€™ve scheduled a task to run a php script and pointed it to cron.php.

When I run the task, the task runs successfully (in Plesk), but has the following message:
ā€œBad data passed in; Return to Homeā€

When I look at the schedulers in the Admin page of SuiteCRM, there are no completed jobs.

Iā€™ve stepped through the code and noticed that the failure happens at the following line of code:

  • cron.php: require_once(ā€˜include/entryPoint.phpā€™);
  • entryPoint.php: clean_incoming_data();
  • utils.php: clean_incoming_data() <-- Itā€™s happening somewhere from a call within this formula.

My environment

  • SuiteCRM Version used: 7.11.70
  • Browser name and version (e.g. Chrome Version 51.0.2704.63 (64-bit)): Chrome Version 79.0.3945.88
  • Environment name and version (e.g. MySQL, PHP 7): PHP 7
  • Operating System and version (e.g Ubuntu 16.04): Windows (shared hosting)

Thanks for moving this discussion here. :tada:

What does the batch file youā€™re using with the Scheduler look like? Are you calling command-line (CLI) PHP, or making a web request?

The behaviour youā€™re getting is typical for when a user is not logged in, so the request isnā€™t allowed. But this shouldnā€™t be happening for CLI PHP.

Sorry for the delayed reply. Iā€™ll have to figure out how to get notified when thereā€™s a response.

Since the original post, I set ā€œ$dieOnBadData = falseā€ in the clean_string function header. The scheduler is now firing, but Iā€™d like to fix the root cause and change it back to true.

Following is what I had in the batch file.

cd C:\Program Files (x86)\Plesk\Additional\PleskPHP70\
php.exe -q -f  D:\InetPub\vhosts\<domain>\crm.<domain>\cron.php

Also, ā€œSchedule Taskā€ in Plesk allows you to just call a php file to run the script. Using the batch file and running the script via calling a file has the same outcome.

Thanks for your help @pgr!

Exactly which filter is breaking in clean_string?

You should have FATAL messages specifying the filter in your suitecrm.log, coming from here:

The two fatal errors I have from today are:

Fri Jan 17 04:57:42 2020 [156784][1][FATAL] IP Address mismatch: SESSION IP: 174.xxx.xxx.x CLIENT IP: 73.xxx.xxx.xxx
Fri Jan 17 03:28:32 2020 [150372][1][FATAL] Caught Exception While Syncing User:1

You donā€™t have a message with that sentence I highlighted above? Did you get a bad data passed in today?

Maybe try changing the message in the die:

die("Bad data passed in, string is {$str} and filter is {$filter}; <a href=\"{$sugar_config['site_url']}\">Return to Home</a>");

Iā€™m not getting an error in suitecrm.log, but the task scheduler displays the output from running the task. What I get there is:

Bad data passed in, string is D:\InetPub\vhosts<domain>\crm.\cron.php and filter is SAFED_GET; Return to Home

Ok, now weā€™re getting somewhere, check this regexp

something in your data is triggering that, maybe the dot .?

EDIT: I think the lack of the message in suitecrm.log is a bug, please see if you can figure that one out, also. Maybe try moving the logging command outside the condition

Ok, I had to remove the following for the string to pass:

A-Z, ., #, and #i

In terms of the log entry, I moved that line of code to just before the die call. It now posts the error and stack trace in the output when I run the script, but still doesnā€™t post the error to suitecrm.log.

1 Like

This is strange, maybe it doesnā€™t finish flushing the log because it dies immediately after. Oh well :man_shrugging:

Yeah, itā€™s strange. A debugging project for another time :slight_smile:

Thanks for your help!