CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviReport (Moderator: Dave Greenberg) »
  • Memory Allocation Errors (when running PDF report)
Pages: [1]

Author Topic: Memory Allocation Errors (when running PDF report)  (Read 20451 times)

haydos

  • Guest
Memory Allocation Errors (when running PDF report)
October 25, 2009, 03:09:14 am
Hi,

When clicking on 'PDF' button from a report in CiviCRM, getting following errors alternating.

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 46 bytes) in C:\xampplite\htdocs\joomla\administrator\components\com_civicrm\civicrm\packages\dompdf\include\style.cls.php on line 159

I have set PHP memory limit to 128MB but still occurs. Also have checked on two separated web servers with same results. Currently is running on XAMPPLITE.

When clicking on 'PDF' in some reports also will make internet explorer come back with 'Internet Explorer cannot display the webpage'

Any ideas ??

I have reviewed other forum posts but cannot find anything.....

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Memory Allocation Errors (when running PDF report)
October 25, 2009, 07:35:13 am

1. whats happens when u set it to 256M?

2. u might want to post on the dompdf forums. we use this library to generate pdf from html documents (http://code.google.com/p/dompdf/)

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

haydos

  • Guest
Re: Memory Allocation Errors (when running PDF report)
October 25, 2009, 01:41:26 pm
I have increased to 256MB and same results, some reports are displaying this and others are displaying page cannot be displayed.

Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 52 bytes) in C:\xampplite\htdocs\joomla\administrator\components\com_civicrm\civicrm\packages\dompdf\include\frame_factory.cls.php on line 169

any ideas before submitting to other forum?

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Memory Allocation Errors (when running PDF report)
October 25, 2009, 05:31:14 pm

u'll need to chat with the dompdf folks and post it there

please update this topic if you get a resolution / patch for this

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

prickeke

  • I post occasionally
  • **
  • Posts: 64
  • Karma: 4
Re: Memory Allocation Errors (when running PDF report)
November 08, 2009, 08:52:43 pm
I'm getting the same error when using CiviCRM 3.0.2.  Was there any resolution to this?

Thanks,
--
Keith

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Memory Allocation Errors (when running PDF report)
November 09, 2009, 06:53:52 am

keith:

not that we've heard of :( but would be great and useful if you can follow up with the dompdf folks

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

prickeke

  • I post occasionally
  • **
  • Posts: 64
  • Karma: 4
Re: Memory Allocation Errors (when running PDF report)
November 09, 2009, 08:41:32 am
What version of DOMPDF are you using for CiviCRM 3.0.2

prickeke

  • I post occasionally
  • **
  • Posts: 64
  • Karma: 4
Re: Memory Allocation Errors (when running PDF report)
November 09, 2009, 09:06:24 am
I've filed an issue with DOMPDF:
http://code.google.com/p/dompdf/issues/detail?id=87

greenmachine

  • I post occasionally
  • **
  • Posts: 58
  • Karma: 6
Re: Memory Allocation Errors (when running PDF report)
December 07, 2009, 12:49:39 am
With my system set to 128 MB for PHP's memory limit and 300 seconds for PHP's max execution time, I can get most of the reports to export to PDF successfully. The exception is Constituent Details, which requires memory_limit = 300M in addition to the max_execution_time setting, otherwise it runs out of memory or time.

The site I'm testing on is 2.2.9 and only has 359 contacts (most of which have a membership, event and/or contribution record). I'm guessing sites with more data will run into memory problems with more of the reports.

I've opted to add this line of code to the top of civicrm/CRM/Utils/PDF/Utils.php:

Code: [Select]
ini_set('memory_limit', '300M');
Might not work for all webhosts, but in my case it allows me to set a higher memory limit just for the PDF export process (and not for the whole site).

resga

  • I post occasionally
  • **
  • Posts: 38
  • Karma: 3
  • CiviCRM version: 3.4.2
  • CMS version: Drupal
  • MySQL version: 5.1.41
  • PHP version: 5.3
Re: Memory Allocation Errors (when running PDF report)
May 20, 2011, 02:21:09 am
I also get a white screen crash when printing PDF letters with about 30 tokens on each page, to more than 50 contacts, on localhost.

In my apache log file, /var/log/apache2/error.log: [error] [client 127.0.0.1] PHP Fatal error: Allowed memory size of 201326592 bytes exhausted (tried to allocate 88 bytes) in [...]/sites/all/modules/civicrm/packages/dompdf/include/frame_factory.cls.php on line 169

I upped the Apache server memory limit to 300M (it was 192M before) in /etc/php5/apache2/php.ini (gksudo gedit /etc/php5/apache2/php.ini):
Code: [Select]
  ; Maximum amount of memory a script may consume (128MB)
  ; http://php.net/memory-limit
  memory_limit = 300M

...and restarted the apache server with "sudo /etc/init.d/apache2 restart" (I am using Ubuntu)
 
And also in civicrm.settings.php:
Code: [Select]
  if ($memLimit >= 0 and $memLimit < 67108864) {
      ini_set('memory_limit', '300M');
  }

I can print around 30 contacts now, but am getting new errors when I try with 80 contacts:

Allowed memory size of 314572800 bytes exhausted (tried to allocate 101 bytes) in [...]/sites/all/modules/civicrm/packages/dompdf/include/stylesheet.cls.php on line 246

...and                                 

Allowed memory size of 314572800 bytes exhausted (tried to allocate 87 bytes) in [...]/sites/all/modules/civicrm/packages/dompdf/include/style.cls.php on line 519
« Last Edit: May 20, 2011, 02:54:36 am by resga »

resga

  • I post occasionally
  • **
  • Posts: 38
  • Karma: 3
  • CiviCRM version: 3.4.2
  • CMS version: Drupal
  • MySQL version: 5.1.41
  • PHP version: 5.3
Re: Memory Allocation Errors (when running PDF report)
May 20, 2011, 05:14:19 am
I just found this: "...Even so, I think the real problem is that DOMPDF is just having trouble handling your table. DOMPDF, even in the beta release, is still fairly inefficient in its handling of large, multi-page, and nested tables."
http://groups.google.com/group/dompdf/browse_thread/thread/a1ae51a73822b139

I did have a few tables in my PDF template, nothing complicated. But if I remove them, all 82 pages are exported to a PDF file, yay! Now I just have to figure out another way to position my elements...
Perhaps with <div style="margin-left: 50px;">? I hope DIV's are more easily digested by DOMPDF 8o)
« Last Edit: May 20, 2011, 05:50:34 am by resga »

resga

  • I post occasionally
  • **
  • Posts: 38
  • Karma: 3
  • CiviCRM version: 3.4.2
  • CMS version: Drupal
  • MySQL version: 5.1.41
  • PHP version: 5.3
Re: Memory Allocation Errors (when running PDF report)
May 20, 2011, 12:17:07 pm
You can't float DIV's left or right in DOMPDF, which makes column building difficult, but there is a workaround, using negative margins. Just add the height of the first DIV, in negative pixels (-90px) as margin-bottom for the first DIV, and the same value as margin-top for the second DIV, which you want next to the first one. It will look horrible in the CK-editor, but the PDF's look fine. And, most importantly, no WSOD so far 8o)

Code: [Select]
<div style="width: 250px; border-style: double; margin-bottom: -90px;">
{membership.name}<br />
Fee<br />
Total kr.<br />
<span style="margin-left: 50px;">kr. {membership.min_and_late_fee_total}.00</span>
</div>
<div style="width: 250px; border-style: double; margin-top: -90px; margin-left: 450px;">
kr. {membership.minimum_fee}<br />
kr. {membership.late_fee}<br />
kr. {membership.min_and_late_fee_total}.00<br />
<span style="margin-left: 50px;">20/5-2011</span>
</div>

Result:
--------------------------------
Single                 kr. 300
Fee                     kr. 25
Total                   kr. 325
   kr. 325,00             20/5-2011
« Last Edit: May 20, 2011, 12:27:23 pm by resga »

MulderDSM

  • I post occasionally
  • **
  • Posts: 100
  • Karma: 0
  • CiviCRM version: 4.6.0
  • CMS version: Joomla 3.4.1
Re: Memory Allocation Errors (when running PDF report)
May 26, 2011, 10:48:57 am
Prior to upgrading this past weekend from Joomla 1.5 and CiviCRM 3.1.4? to Joomla 1.6 and CiviCRM 4.0.1, I had no problem running CiviReports and producing a PDF. Now when I run any of the same reports, and select PDF I get this error:

Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 1966080 bytes) in /home/thinkdif/public_html/dna/joomla/administrator/components/com_civicrm/civicrm/packages/dompdf/lib/class.pdf.php(1969) : eval()'d code on line 5914

resga

  • I post occasionally
  • **
  • Posts: 38
  • Karma: 3
  • CiviCRM version: 3.4.2
  • CMS version: Drupal
  • MySQL version: 5.1.41
  • PHP version: 5.3
Re: Memory Allocation Errors (when running PDF report)
May 26, 2011, 12:02:21 pm
My 3.4.1 Drupal installation can handle printing up to 100 contacts, using DIVs and not tables. It takes around 110 seconds to generate the PDF file, which is 75 KB big. If I try with more than that I get WSOD after 30 seconds.

EDIT: If I increase max_execution_time to 360 seconds in php.ini I can print 124 pages in 180 seconds. Other results:
54 pages = 31 seconds
101 pages = 110 seconds
124 pages = 180 seconds
165 pages = WSOD after 30 seconds
« Last Edit: May 27, 2011, 02:16:07 pm by resga »

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviReport (Moderator: Dave Greenberg) »
  • Memory Allocation Errors (when running PDF report)

This forum was archived on 2017-11-26.