Allowed memory size exhausted in AddSummaryRow.php on line 357


#1

Hi,

Possible memory leak/bug?

Running Piwik 1.7, php 5.3.2 on Ubuntu 10.04.
On a non high volume site I am getting:


Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 523800 bytes) in /var/www/piwik/core/DataTable/Filter/AddSummaryRow.php on line 357

I had max memory set to 128MB in php.ini, tried with 256 (as the error shows) and even 512MB, but getting the same result.

I can not even find a row 357 in AddSummaRow.php, but I don’t know php, so I guess there can be includes and such?

Anyone had similar issues? Any ideas?

I suspect something is looping?

Cheers,
Tomas


(Matthieu Aubry) #2

Are you sure about this error message? indeed it’s strange since there is no such line in the file.
Do you have more complete error message or is it all you got?


#3

Yep that is all I got. White screen from apache, with this single line of error message in it.

What log files may be relevant to check?


#4

I have same exact problem. Looks like “Actions” items are problems. If I select all items in Actions and 2 or 3 other items, I get memory error. OR IF I select everything and two Actions, I get memory error. If I select only one… its ok.

PHP memory set to 512M. Does not matter if I select HTML or PDF.


#5

I get


Fatal error: Allowed memory size of 58720256 bytes exhausted (tried to allocate 32 bytes) in /home/.sites/51/site515/web/_piwik_ana/core/DataTable.php on line 351

when i try to download a report without “Actions - Main metrics”. when i select “Actions - Main metrics” i get no errors.

F


(Matthieu Aubry) #6

Please setup: How to Set up Auto-Archiving of Your Reports - Analytics Platform - Matomo
and increase memory settings in php.ini - it should hopefully fix the issue?


#7

Hi,

“Actions - Main metrics” did the trick for us. Thanks a lot!

We have recently enabled auto archiving. Our site is not very big, but It’s probably good anyhow.

Cheers,
Tomas


#8

i still think that this is a bug.
why would i need less memory with “Actions - Main metrics” enabled?


#9

I changed php memory in php.ini to 512MB, no go. I changed to 1024MB… no go. I don’t think I have setup this high.


#10

I have created a cron job as described for larger sites. It also tries to trigger automatic reports. I get this error in the cron log.

Error: Got invalid response from API request: http://stat.primekey.se/piwik/index.php?module=API&method=CoreAdminHome.runScheduledTasks&format=csv&convertToUnicode=0&token_auth=00f8f07e25dc669ef4b1ef4315fdd622&trigger=archivephp. Response was ‘Fatal error: Allowed memory size of 805306368 bytes exhausted (tried to allocate 523800 bytes) in /var/www/piwik/core/DataTable/Filter.php on line 36’

Perhaps that file and line gives some more indication?

Full cron output:

Subject: Cron www-data@bunny /usr/bin/php5 /var/www/piwik/misc/cron/archive.php --url=http://stat.primekey.se/piwik/ > /var/log/piwik/piwik-archive.log
Content-Type: text/plain; charset=ANSI_X3.4-1968
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin>
X-Cron-Env: <HOME=/var/www>
X-Cron-Env: <LOGNAME=www-data>
X-Virus-Scanned: ClamAV using ClamSMTP

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://stat.primekey.se/piwik/index.php?module=API&metho
d=CoreAdminHome.runScheduledTasks&format=csv&convertToUnicode=0&token_auth=00f8f07e25dc669ef4b1ef4315fdd622&trigger=archivephp. Response was ‘Fatal error: Allowed memory size of 805306368 bytes exhausted (t
ried to allocate 523800 bytes) in /var/www/piwik/core/DataTable/Filter.php on line 36’

Here is the full output of the script:


INIT
Querying Piwik API at: http://stat.primekey.se/piwik/index.php
Running as Super User: admin
Notes

  • Reports for today will be processed at most every 1800 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 53s ago
    Will process 2 websites with new visits since 59 min 53s , IDs: 1, 5

START
Starting Piwik reports archiving…
Archived website id = 1, period = day, Time elapsed: 0.173s
Archived website id = 1, period = week, 411 visits, Time elapsed: 0.226s
Archived website id = 1, period = month, 1912 visits, Time elapsed: 0.499s
Archived website id = 1, period = year, 26112 visits, Time elapsed: 0.968s
Archived website id = 5, period = day, Time elapsed: 0.189s
Archived website id = 5, period = week, 2474 visits, Time elapsed: 0.235s
Archived website id = 5, period = month, 11945 visits, Time elapsed: 0.665s
Archived website id = 5, period = year, 94595 visits, Time elapsed: 1.671s
Done archiving!

SUMMARY
Total daily visits archived: 15
Archived today’s reports for 2 websites
Archived week/month/year for 2 websites.
Skipped 3 websites: no new visit since the last script execution
Skipped 0 websites day archiving: existing daily reports are less than 1800 seconds old
Skipped 0 websites week/month/year archiving: existing periods reports are less than 3600 seconds old
Total API requests: 8
done: 2/2 100%, 15 v, 2 wtoday, 2 wperiods, 8 req, 4630 ms, no error
Time elapsed: 4.630s

SCHEDULED TASKS
Starting Scheduled tasks…
ERROR: Got invalid response from API request: http://stat.primekey.se/piwik/index.php?module=API&method=CoreAdminHome.runScheduledTasks&format=csv&convertToUnicode=0&token_auth=00f8f07e25dc669ef4b1ef4315fdd622&trigger=archivephp. Response was ‘Fatal error: Allowed memory size of 805306368 bytes exhausted (tried to allocate 523800 bytes) in /var/www/piwik/core/DataTable/Filter.php on line 36’

done

SUMMARY OF ERRORS
Error: Got invalid response from API request: http://stat.primekey.se/piwik/index.php?module=API&method=CoreAdminHome.runScheduledTasks&format=csv&convertToUnicode=0&token_auth=00f8f07e25dc669ef4b1ef4315fdd622&trigger=archivephp. Response was 'Fatal error: Allowed memory size of 805306368 bytes exhausted (tried to allocate 523800 bytes) in /var/www/piwik/core/DataTable/Filter.php on line 36’
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://stat.primekey.se/piwik/index.php?module=API&method=CoreAdminHome.runScheduledTasks&format=csv&convertToUnicode=0&token_auth=00f8f07e25dc669ef4b1ef4315fdd622&trigger=archivephp. Response was 'Fatal error: Allowed memory size of 805306368 bytes exhausted (tried to allocate 523800 bytes) in /var/www/piwik/core/DataTable/Filter.php on line 36’
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://stat.primekey.se/piwik/index.php?module=API&method=CoreAdminHome.runScheduledTasks&format=csv&convertToUnicode=0&token_auth=00f8f07e25dc669ef4b1ef4315fdd622&trigger=archivephp. Response was ‘Fatal error: Allowed memory size of 805306368 bytes exhausted (tried to allocate 523800 bytes) in /var/www/piwik/core/DataTable/Filter.php on line 36’ in /var/www/piwik/misc/cron/archive.php on line 519

–052FDE281A.1330905924/mail.primekey.se–
*** HEADER EXTRACTED deferred/2/23DD0E2822 ***
*** MESSAGE FILE END deferred/2/23DD0E2822 ***


(Matthieu Aubry) #11

Increase your memory php limit. We have some work to do to make this better: Archiving Memory exhausted error - Archiving memory leaks · Issue #766 · matomo-org/matomo · GitHub


#12

So what memory limit do you suggest for a small website? Is 2GB enough?


#13

Generating reports really does not work. Even with a 2GB limit.
A simple monthly report, low traffic sites, can not generate a PDF report.

[Sat Aug 04 11:08:34 2012] [error] [client 1.2.34] PHP Fatal error: Allowed memory size of 2147483648 bytes exhausted (tried to allocate 71 bytes) in /var/www/piwik/core/DataTable/Manager.php on line 77, referer: https://stat.mysite.qwe/piwik/index.php?module=PDFReports&action=index&idSite=1&period=week&date=2012-08-01&updated=1

I edited our report to figure out what caused the issue. I can include every type of statistic in the report except “Referrer type”.

We are happpy for now, since Referrer type is not important in reports. Viewing it in the web pages works fine, only in reports does not work. Soa hint for other people having memory problems with reports is to exclude “Referrer Type”.

If Piwik team is interested, I can offer access to our Piwik, or database dumps or something like that.

Cheers,
Tomas


(Matthieu Aubry) #14

We fixed some bugs related to this, please try to upgrade to 1.8.3-b2: 301 Moved Permanently


#15

I installed the beta and tested. Indeed it does work!

Good work, thanks a lot!

Cheers,
Tomas