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 CiviMail (Moderator: Piotr Szotkowski) »
  • Possible CiviMail memory leak?
Pages: [1]

Author Topic: Possible CiviMail memory leak?  (Read 1138 times)

xcf33

  • I post frequently
  • ***
  • Posts: 181
  • Karma: 7
  • CiviCRM version: 3.3.2
  • CMS version: Drupal 6.19/6.20
  • MySQL version: 5.x
  • PHP version: 5.2.6
Possible CiviMail memory leak?
February 07, 2011, 01:39:01 pm
Hi guys,

we have our civimail sending at a pretty fast speed.

On our 1GB server, we are able to have CiviMail spit out to 120K contacts to our SMTP in 40 minutes. However, during the period of sending our website in the front end will start to hang. Browser pointing to the website will continue to say "Waiting for server to reply", we will not be able to SSH into the server, so on and so forth. Server console continues to say "System out of memory, Apache killing process XXXX". (repeatedly)

We have the PHP memory limit set at first at 1024 MB then 896 MB. Both cases the website hangs.


I'm just wondering if the DAO is leaking memory in the mailing code since I've discovered before that it happens from time to time in other areas of the system.



Cheers!


xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Possible CiviMail memory leak?
February 07, 2011, 01:46:18 pm
do use php-cli, nice it.

CHeck our book for more detail, good luck
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

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: Possible CiviMail memory leak?
February 07, 2011, 02:07:00 pm

we had eliminated most/all major leaks for civimail in 1.9. If i had to guess and based on what you are seeing, a few other leaks have cropped up. Debugging memory leaks in PHP is a long drawn out process, check:

http://civicrm.org/blogs/lobo/optimizing-civicrm-export-stop-leaking-memory

for one example. i think civimail code is in decent shape and finding the leak might not take too long. ping me on irc if u need help getting started

A short term solution might be to introduce a batch size of 5K or so, and have multiple jobs running

wondering what other things we can do to get it to deliver 1 million in 1 hour :). I suspect we'll see a 10-50% increase if the leak is found and fixed. Just need another 5x increase

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

xcf33

  • I post frequently
  • ***
  • Posts: 181
  • Karma: 7
  • CiviCRM version: 3.3.2
  • CMS version: Drupal 6.19/6.20
  • MySQL version: 5.x
  • PHP version: 5.2.6
Re: Possible CiviMail memory leak?
February 07, 2011, 02:59:54 pm
At max speed, we were able to do 100k emails in 20 minutes to that would be 300 k / hour.

I don't think it's that impossible. :)

xcf33

  • I post frequently
  • ***
  • Posts: 181
  • Karma: 7
  • CiviCRM version: 3.3.2
  • CMS version: Drupal 6.19/6.20
  • MySQL version: 5.x
  • PHP version: 5.2.6
Re: Possible CiviMail memory leak?
June 21, 2011, 02:35:07 pm
I put this following code into the

Code: [Select]
  $q = array( );
         foreach ( array_keys( $_DB_DATAOBJECT['RESULTS'] ) as $id ) {
         $q[] = $_DB_DATAOBJECT['RESULTS'][$id]->query;
         }
         // CRM_Core_Error::debug( 'k', $q );
    file_put_contents('/var/www/memory.txt', print_r($q, TRUE), FILE_APPEND);

CRM_Mailing_Job::deliverGroup

http://pastebin.com/QuJAfeb4

and again inside of its loop:

http://pastebin.com/dpq095WL

It's just a bunch of queries, what can we use this to determine which DAO object to free?

Thanks,


Chang

xcf33

  • I post frequently
  • ***
  • Posts: 181
  • Karma: 7
  • CiviCRM version: 3.3.2
  • CMS version: Drupal 6.19/6.20
  • MySQL version: 5.x
  • PHP version: 5.2.6
Re: Possible CiviMail memory leak?
June 22, 2011, 03:45:13 pm
I did a diff on 3.32 (current version we are using) to 3.4

http://pastebin.com/Zy2kixK3

There are a lot of changes and mainly replaced

   require_once 'api/v2/Activity.php';
          $isError = civicrm_activity_create( $activity );

with

 if (is_a(CRM_Activity_BAO_Activity::create($activity), 'CRM_Core_Error')) {
                 return false;
             }

As I found out that the activity create API v2 does around 200 MB memory leak per 100,000 email with xMemory utility function. It's still not the big one I'm seeing.

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Possible CiviMail memory leak?
June 23, 2011, 02:08:10 am
I took a quick look & I think v3 api should be OK on the memory leak

      return civicrm_api3_create_success($activityArray,$params,$activityBAO);

The create_sucess function frees the DAO object so as long as it's passed in there should be no leak
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviMail (Moderator: Piotr Szotkowski) »
  • Possible CiviMail memory leak?

This forum was archived on 2017-11-26.