Opened 3 years ago

Closed 3 years ago

#2052 closed Bug (fixed)

Creation of PDF reports fails in some cases, uses too much memory

Reported by: tvanerp Owned by:
Priority: normal Milestone: Piwik 1.2
Component: Core Keywords:
Cc: Sensitive: no

Description

When I try to create any PDF report from a medium traffic website (300-500 visitors a day) and the Seach engines option under references is checked i get the folowing error:

Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 523800 bytes) in /var/www/vhosts/######/httpdocs/libs/tcpdf/tcpdf.php on line 7794

Attachments (1)

2052.patch (2.1 KB) - added by vipsoft 3 years ago.

Download all attachments as: .zip

Change History (14)

Changed 3 years ago by vipsoft (robocoder)

comment:1 Changed 3 years ago by vipsoft (robocoder)

  • Keywords piwik pdf report removed
  • Milestone changed from 1.x - Piwik 1.x to 1.2 Piwik 1.2

memory issues are generally covered by #766

can you see if the attached patch helps?

comment:2 Changed 3 years ago by tvanerp

The patch didn't work. I still get the same error.

comment:3 Changed 3 years ago by vipsoft (robocoder)

You're probably missing this mem leak patch: [3670].

comment:4 Changed 3 years ago by tvanerp

The mem leak patch didn't solve it either.

comment:5 Changed 3 years ago by vipsoft (robocoder)

The tcpdf library has some unusually large memory requirements when there are images. The only workaround at this point is to increase your max memory limit (see php.ini).

comment:6 Changed 3 years ago by vipsoft (robocoder)

  • Resolution set to answered
  • Status changed from new to closed

comment:7 Changed 3 years ago by tvanerp

The memory limit is already at 256M, I really don't want to allow it to take it more memory. Is there a way to make reports without images?

comment:8 Changed 3 years ago by vipsoft (robocoder)

I'm going to report this upstream. Otherwise I'd have to dig thru the tcpdf code to figure out why it needs a meg of memory for a tiny search engine icon.

comment:9 Changed 3 years ago by tvanerp

cheers, I'll keep an eye on it

comment:10 Changed 3 years ago by vipsoft (robocoder)

Another idea would be to try with the imagick extension installed as it uses a different code path in tcpdf. http://ca.php.net/manual/en/book.imagick.php

comment:11 Changed 3 years ago by vipsoft (robocoder)

(In [3848]) fixes #2067, refs #2052 - remove alpha channel (transparent layer) from icons

For future reference, use ImageMagick:

  • convert image.png -background white -flatten +matte image_new.png

comment:12 Changed 3 years ago by matt (mattab)

  • Resolution answered deleted
  • Status changed from closed to reopened
  • Summary changed from Creation of PDF reports fails when Search engines is checked (piwik 1.1.1) to Creation of PDF reports fails in some cases, uses too much memory

comment:13 Changed 3 years ago by matt (mattab)

  • Resolution set to fixed
  • Status changed from reopened to closed
Note: See TracTickets for help on using tickets.