Archive.php Error - Response was 'curl_exec: Empty reply from server'

Since I havent found a solution to the following within days of searching, i guess i give it a try and ask the piwik forums about this.

I guess it occured since i updated our installations to one of the previous versions (maybe 1.10, i guess. i did one or two piwik updates after the error started to occur, hoping it would fix the problem) that i get the following error message from the piwik archiving cronjob:


[...]
---------------------------
SCHEDULED TASKS
Starting Scheduled tasks... 
ERROR: Got invalid response from API request: https://piwik.example.com/index.php?module=API&method=CoreAdminHome.runScheduledTasks&format=csv&convertToUnicode=0&token_auth=TOKEN&trigger=archivephp. Response was 'curl_exec: Empty reply from server'

done
---------------------------
SUMMARY OF ERRORS
Error: Got invalid response from API request: https://piwik.example.com/index.php?module=API&method=CoreAdminHome.runScheduledTasks&format=csv&convertToUnicode=0&token_auth=TOKEN&trigger=archivephp. Response was 'curl_exec: Empty reply from server'
1 total errors during this script execution, please investigate and try and fix these errors
ERROR: 1 total errors during this script execution, please investigate and try and fix these errors. First error was: Got invalid response from API request: https://piwik.example.com/index.php?module=API&method=CoreAdminHome.runScheduledTasks&format=csv&convertToUnicode=0&token_auth=TOKEN&trigger=archivephp. Response was 'curl_exec: Empty reply from server'
PHP Fatal error:  1 total errors during this script execution, please investigate and try and fix these errors. First error was: Got invalid response from API request: https://piwik.example.com/index.php?module=API&method=CoreAdminHome.runScheduledTasks&format=csv&convertToUnicode=0&token_auth=TOKEN&trigger=archivephp. Response was 'curl_exec: Empty reply from server' in /export/apache/www/misc/cron/archive.php on line 576

  • The result of this error is that sometimes our customers get their PDF reports, and sometimes not. Sometimes it seems to work because e-mails with PDF documents are delivered, the error message though occurs every day.

  • Archiving of stats work like a charm, everything else besides the scheduled tasks is executed just fine.

  • There are no further errors, not inside the php logs, apache logs or system logs.

  • The System is an up-to-date Debian 6 running Piwik 1.11.1. Cron archiving worked like a charm with archive.sh and later on with archive.php. Switching back to archive.sh solves the problem but i would like to continue using archive.php.

  • Manually triggering the API request shows the following result inside the browser window: “No data available”. I guess that there just arent any daily reports to generate since they should already have been generated by the daily cronjob.

  • Memory limits are set to “1024M”, which should be more than enough

This is a bug in 1.11.1 fixed in latest beta: Index of /

The described Problem seems to continue to persist. We updated our Piwik Installation to the latest stable 1.12 which brought no change in behaviour of the automated archiving with archive.php.

Any new Information on this?
Should i provide more details?

  • There are no further errors, not inside the php logs, apache logs or system logs.

there should be an error in the error log, about this, or maybe the error log is mis configured?

Hi Matt,

php error logging should be okay but, just to be sure, i once again checked it and further extended the logging so once the weekend is over and the nightly jobs ran a few times, i should be able to provide more information if available.

The really weird thing is that, if piwik archiving runs smoothly without any error our users wont get any email reports, if archiving finishes with error everything seems to be fine…

Archiving on tuesday, thursday finished with error, users got daily reports in their inbox
Archiving on monday, wednesday, friday finished without error, users aint got daily reports in their inbox

So every second day, users get mail besides piwik archiving saying that there were errors withing the sheduled tasks, its just the opposite from what occured inside piwik 1.11 where users only recieved mail in case the job finished without error.

Have a nice weekend, i will reply to this thread on monday.

So, collected a little more information about that problem, which still persists.

The only type of php error i was able to fetch is:

[02-Jul-2013 03:12:29] PHP Fatal error: 1 total errors during this script execution, please investigate and try and fix these errors. First error was: Got invalid response from API request: https://piwik.example.com/index.php?module=API&method=CoreAdminHome.runScheduledTasks&format=csv&convertToUnicode=0&token_auth=TOKEN&trigger=archivephp. Response was ‘curl_exec: Empty reply from server’ in /export/apache/www/misc/cron/archive.php on line 573

Now maybe the more interesting part.
[ul]
[li] Monthly Reports work like a charm
[/li][li] Weekly Reports work like a charm
[/li][li] Daily Reports are only recieved every second day
[/li][/ul]

First i thought it might be because we only did archiving once a day and since the processing sometimes takes 25 minutes and other times it takes 30 minutes, full 24 hours would not have passed since the last report, it would then just not send any report. I then switched to archiving two times a day but the problem continues to exist.

But the most funny thing occured today, lets just view it in a table:


--------------------------------------------------------------------------------------------------------------------------------------------------
     26.06.2013     |     27.06.2013     |     28.06.2013     |     29.06.2013     |     30.06.2013     |     01.07.2013     |     02.07.2013     |
--------------------------------------------------------------------------------------------------------------------------------------------------
Archiving error     |                    |Archiving error     |                    |Archiving error     |Archiving error     | Archiving and Rep. |
Recieved Daily Rep. |                    |Recieved Daily Rep. |                    |Recieved Daily Rep. |                    | sending will be    |
                    |                    |                    |                    |                    |Recieved Monthly Rep| triggered on       |
                    |                    |                    |                    |                    |Recieved Weekly Rep.| 03.07.2013         |
--------------------------------------------------------------------------------------------------------------------------------------------------

* Archiving always runs on the next day but for better viewability i put the archiving job to the day to which it belongs

As you can see, we only recieved daily reports when archiving finishes with error and we recieved weekly and monthly reports besides the archiving finishes with error. But then today, an archiving error which does not fit to the “every second day” schema, and no daily report…

And so, finally, i came to the conclusion…

Just curious what version of python are you running on the server?

@lesjokolat nothing to do with python…
@Khabaal we will release a new version in 1 week or so, which may fix this error.

Thanks Matt,

will wait for the next version and further look into the details of this error.