PDF Reports not working

Hi PIWIK People

I am having difficulty getting large PDF Reports to work.

I have a very busy site (serving over 250,000 pages a day)

PIWIK 1.8.2 is up and running with no issues in WIndows2003/IIS6/MySQL 5.1.11/PHP5.2.11

I have a working Cron Archive that is Archiving every 30 mins (In this case it is using the Windows Scheduler as described in the PIWIK help file for Windows Users.

So all is well.

The PDF Report feature is functioning if the reports are only set for a period of a day.

The issue comes when I try to run a large PDF report (Either email or download) for a period of a week.

I have set the PHP.INI :

Memory from 128M to 512M (PIWIK is on a server with 4GB of RAM)

I have increased the max_execution_time from 30 to 60

I am now on the edge of my knowledge and as this is a live service I don’t want to “Meddle”.

I’m not sure where I would look to find errors?

Can anyone point me at the setting that may fix this?

Thanks in advance

Colin

Its great you increased the PHp.ini up to teh 512 how high is the apache memory set to?

The installation is on IIS not Apache

Opps then my bad should have read closer! Sorrry

If you experiment a bit as far as push the time range from one to two days then 3 perhaps those results will help someone else determine the cause.

Can you try with smaller reportlets and see if the dashboard has only one or two then allows you to create PDFs from wider time frame?

It produces the report if I close all of the dash board items. I’ll give it a go with some switched on soon

I should have said thanks as I can at least produce reports! How rude of me.

hehe not at all. Its hard as when people hit road blocks its hard to describe it and we often forget little things or details that can be of help.

Sounds like the issue is a large dashboard with many reportlets not able to capture a weeks time frame.

Anyone find this fix for that yet?
www.sonicpro.com
www.firelineinfo.com

Have you bumped up memory as per previous n the thread?

Memory from 128M to 512M (PIWIK is on a server with 4GB of RAM)

I have increased the max_execution_time from 30 to 60

I have a similar issue with only one site on my Piwik install, even after bumping php up to 512mb… which seemed totally unnecessary as all of the sites on this piwik instance are low-traffic sites.

If i remove the 3 reports with “Page Titles” from the PDF report, the ‘download report’ and ‘send email report now’ now work without the memory error.

I have not tracked down what those report sections are doing in the PDF versions that could be causing the issue though. The live/web versions of the Page Title data seems to work fine for that same site.

Just to clarify, the issue resolved by removing the Page Title pdf report sections was occuring on Apache. However, I suspect that the underlying problem is in piwik’s handling of the data somewhere, so it may be irrelevant.

Hi

Just to clarify that it’s not the report items that need deseslecting. It’s the applets on the Piwik control panel screen that fixes the problem for me. You need to close the windowlets if you like. When I close them all and then go the email reports the donload then works. It’s then simple to switch them back on again

I hope this helps

Colin

  1. Do you see any error in the Web server Error logs ?
    Please report here.

  2. Apply this patch: 301 Moved Permanently

  3. after waiting for new day or testing report, does it now work?

I originally looked into the issue because I received this cron email:


Error in the last Piwik archive.php run: 
1 total errors during this script execution, please investigate and try and fix these errors. First error was: Got invalid response from API request: http://stats.postingplace.com/index.php?module=API&method=CoreAdminHome.runScheduledTasks&format=csv&convertToUnicode=0&token_auth=7abbdde2ba6f830a8b1808d2c48b2f4e&trigger=archivephp. Response was '<!-- SHTML Wrapper - 500 Server Error -->
<!-- PHP Wrapper - 500 Server Error -->
<html><head><title>500 Server Error</title></head> <body bgcolor=white>
<h1>500 S

 Here is the full output of the script:

---------------------------
INIT
Querying Piwik API at: http://stats.postingplace.com/index.php
Running as Super User: admin
Notes
- Reports for today will be processed at most every 900 seconds. You can change this value in Piwik UI > Settings > General Settings.
- Reports for the current week/month/year will be refreshed at most every 3600 seconds.
- Archiving was last executed without error 59 min 13s ago Will process 0 websites with new visits since 59 min 13s
---------------------------
START
Starting Piwik reports archiving...
Done archiving!
---------------------------
SUMMARY
Total daily visits archived: 0
Archived today's reports for 0 websites
Archived week/month/year for 0 websites. 
Skipped 20 websites: no new visit since the last script execution Skipped 0 websites day archiving: existing daily reports are less than 900 seconds old Skipped 0 websites week/month/year archiving: existing periods reports are less than 3600 seconds old Total API requests: 0
done: 0/0, 0 v, 0 wtoday, 0 wperiods, 0 req, 1 ms, no error Time elapsed: 0.001s
---------------------------
SCHEDULED TASKS
Starting Scheduled tasks... 
ERROR: Got invalid response from API request: http://stats.postingplace.com/index.php?module=API&method=CoreAdminHome.runScheduledTasks&format=csv&convertToUnicode=0&token_auth=7abbdde2ba6f830a8b1808d2c48b2f4e&trigger=archivephp. Response was '<!-- SHTML Wrapper - 500 Server Error -->
<!-- PHP Wrapper - 500 Server Error -->
<html><head><title>500 Server Error</title></head> <body bgcolor=white>
<h1>500 Server Error</h1>

A misconfiguration on the server caused a hiccup.
Check the server logs, fix the problem, then try again.
<hr>

URL: http://stats.postingplace.com/index.php?module=API&method=CoreAdminHome.runScheduledTasks&format=csv&convertToUnicode=0&token_auth=7abbdde2ba6f830a8b1808d2c48b2f4e&trigger=archivephp<br>
<!-- CMD Wrapper -->

</body></html>'

done
---------------------------
SUMMARY OF ERRORS
Error: Got invalid response from API request: http://stats.postingplace.com/index.php?module=API&method=CoreAdminHome.runScheduledTasks&format=csv&convertToUnicode=0&token_auth=7abbdde2ba6f830a8b1808d2c48b2f4e&trigger=archivephp. Response was '<!-- SHTML Wrapper - 500 Server Error -->
<!-- PHP Wrapper - 500 Server Error -->
<html><head><title>500 Server Error</title></head> <body bgcolor=white>
<h1>500 S
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: http://stats.postingplace.com/index.php?module=API&method=CoreAdminHome.runScheduledTasks&format=csv&convertToUnicode=0&token_auth=7abbdde2ba6f830a8b1808d2c48b2f4e&trigger=archivephp. Response was '<!-- SHTML Wrapper - 500 Server Error -->
<!-- PHP Wrapper - 500 Server Error -->
<html><head><title>500 Server Error</title></head> <body bgcolor=white>
<h1>500 S


And misc/cron/error_log had this similar information:
[16-Jul-2012 07:54:28] 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: http://stats.postingplace.com/index.php?module=API&method=CoreAdminHome.runScheduledTasks&format=csv&convertToUnicode=0&token_auth=7abbdde2ba6f830a8b1808d2c48b2f4e&trigger=archivephp. Response was ’

500 Server Error

500 S in /home3/postingp/public_html/stats/misc/cron/archive.php on line 555

Since none of the weekly emails were sent, I started going through as Admin and setting up a few test subscriptions and clicking “Download” to test and happened upon one that was causing the page to not load and a memory error to be recorded in php error log:

[26-Mar-2012 11:18:07] PHP Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 76 bytes) in /home3/postingp/public_html/stats/core/DataTable/Manager.php on line 76

Originally the memory limit was 64mb, I had bumped it a few times, ultimately to 512mb trying to resolve it.

[16-Jul-2012 13:08:28] PHP Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 72 bytes) in /home3/postingp/public_html/stats/core/DataTable/Manager.php on line 77

SInce other websites on the same Piwik were working, I started removing sections from the pdf email, ultimatley determining that the pagetitles section was culprit.


Nevertheless, after applying your patch, I am able to generate the report (Download link) where I was not able to before.

Our Piwik database is still very small if getting a backup helps.

Again to be clear – with the patch to core/DataTable/Filter/Truncate.php, I can generate the report with the 3 “Page Title” sections included.
If I comment out the patch, I can still reproduce the original failure unless I also remove those 3 sections from the PDF report.