[Cron] Regular fatal error reports since Piwik 3.0.0 upgrade

Since the Piwik 3.0.0 upgrade we’ve been seeing the following error messages, for varying siteIds. It doesn’t happen on every cron run, and subsequent cron runs often complete successfully. There is no trend which indicates why the issue is being triggered. I’ve no idea if data is being lost (I certainly hope it is not!)

ERROR [2017-01-08 05:05:04] Got invalid response from API request: ?module=API&method=API.get&idSite=&period=day&date=last52&format=php&trigger=archivephp. The response was empty. This usually means a server error. A solution to this error is generally to increase the value of ‘memory_limit’ in your php.ini file. For more information and the error message please check in your PHP CLI error log file. As this core:archive command triggers PHP processes over the CLI, you can find where PHP CLI logs are stored by running this command: php -i | grep error_log
ERROR [2017-01-08 05:05:04] Empty or invalid response ‘’ for website id , Time elapsed: 1.703s, skipping
ERROR [2017-01-08 05:05:04] 2 total errors during this script execution, please investigate and try and fix these errors.

We’re running on Ubuntu 14.04, using PHP 5.5.9-1ubuntu4.20. I’ve attempted to gather error logs, but none are being generated. This makes me think that Piwik is wrong, and that no error is actually occurring. Prior to the upgrade we never had any issues with Piwik’s cronjob.

Hello,

I have exactly the same problem. On one of the 60 sites added on Piwik, I get this error in the logs “piwik-archive.log”

Got invalid response from API request: ?module=API&method=API.get&idSite=4&period=day&date=last2&format=php&trigger=archivephp. The response was empty. This usually means a server error. A solution to this error is generally to increase the value of 'memory_limit' in your php.ini file.  For more information and the error message please check in your PHP CLI error log file. As this core:archive command triggers PHP processes over the CLI, you can find where PHP CLI logs are stored by running this command: php -i | grep error_log

So I have no more visits that archive for this site. (I have increase my memory_limit value from 512M to 2512M without any success…)

I had to change my cron line from this:

/home/piwik/console core:archive --force-all-websites --force-all-periods=432000 --force-date-last-n=2 --url='http://xxxxxxx'  > piwik-archive.log 2>&1

to this :

/home/piwik/console core:archive --force-all-websites --force-all-periods=432000 --force-date-last-n=1 --url='http://xxxxxxxxx'  > piwik-archive.log 2>&1

The visits of the day are now stored, but the bug now occurs on the pre-processing of n weeks instead of the pre-processing of n days.

Where does this problem come from ?

Thanks.

We’ve managed to track down the issue on our installation.
Turns out PHP was segfaulting due to something Piwik was trying to do. You can verify if you are hit as well by running “dmesg” and looking for something like this:

php5[25095]: segfault at 5 ip 000000000070c6a0 sp 00007ffc5288f388 error 6 in php5[400000+7f3000]

Upgrading to PHP 5.6 from ppa:ondrej/php resolved the issue for us - it now processes things perfectly again.

Hi,

Effectively we ave the same error in “dmesg”, upgrade to PHP 5.6 and no more error. Archiving works well now.

Thanks for the tip!