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 »
  • Post-installation Setup and Configuration (Moderator: Dave Greenberg) »
  • Fatal Error: Out of memory - During Synchronization
Pages: [1]

Author Topic: Fatal Error: Out of memory - During Synchronization  (Read 2916 times)

edaniel

  • Guest
Fatal Error: Out of memory - During Synchronization
January 13, 2009, 05:16:04 am
I have  a relatively small Joomla site. I am trying to add CiviCRM on a testing site, and everything went smooth until I tried to synchronize users to contacts. I have 2808 users.


Fatal error: Out of memory (allocated 14680064) (tried to allocate 76 bytes) in /path/to/web/root/public_html/administrator/components/com_civicrm/civicrm/CRM/Mailing/Event/BAO/Subscribe.php on line 47

Trying again yielded this result:

Fatal error: Out of memory (allocated 14680064) (tried to allocate 4864 bytes) in /path/to/web/root/public_html/administrator/components/com_civicrm/civicrm/CRM/Mailing/Event/BAO/Subscribe.php on line 61


After those errors, I noticed that 1108 contacts were created.

CiviCRM  2.1.4
Joomla 1.5.9
PHP 5.2.8
MySQL 5.0.67

I have increased the memory_limit to 128M using php.ini in the webroot and administration directories, to no avail. Any guidance would be greatly appreciated.

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: Fatal Error: Out of memory - During Synchronization
January 13, 2009, 06:30:55 am

Can you rerun it again and see if it processes the other contacts. It only does work on users who dont have a contact :) Ideally a contribution to make that script process "batches" of users would be great

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

edaniel

  • Guest
Re: Fatal Error: Out of memory - During Synchronization
January 13, 2009, 06:36:25 am
Thanks for replying. 

Subsequent runs yield no more contacts.

edaniel

  • Guest
Re: Fatal Error: Out of memory - During Synchronization
January 15, 2009, 11:24:40 am
I deleted all of the contacts and ran it again, and only 682 contacts were created.  Then I ran it again, and just over 800 more were added. Then it wouldn't run any more.

I'm going to try this on a local server, but I'm having some trouble transferring the site.  I'll post here when I get that done.

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: Fatal Error: Out of memory - During Synchronization
January 15, 2009, 11:47:04 am

Your best bet would be:

1. Increase your php execution limit (to 3600 seconds or so)

2. Modify the query at: CRM/Core/BAO/CMSUser.php, line 75

Code: [Select]
        $sql   = "SELECT $id, $mail, $name FROM {$config->userFrameworkUsersTableName} where $mail != ''";

TO

Code: [Select]
        $sql   = "SELECT $id, $mail, $name FROM {$config->userFrameworkUsersTableName} where $mail != '' LIMIT OFFSET,COUNT";

and change OFFSET and COUNT on every run till u process all your contacts. You'll have to tweak these two numbers based on your machine speed etc. I would probably do 200 or so at a time

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

edaniel

  • Guest
Re: Fatal Error: Out of memory - During Synchronization
January 15, 2009, 06:40:33 pm
Cheers!  All 2408 contacts imported.  Thank you!

I did 200 per run and it worked.  I would love to help automate that, but I have only just started with CiviCRM.  Where should I start?

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: Fatal Error: Out of memory - During Synchronization
January 15, 2009, 07:17:49 pm

Multiple places :)

1. tweak the script at CMSUser.php to take the offset from the calling function. return a complete code when no more records left

2. make that call an ajax call that makes an http request with a new offset when the previous request completes. do this till no more records

i suspect item 2 will be the issue and figuring out how to fit that into the framework. take a look at some jQuery stuff and see if there is a helper method u can potentially use

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

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Post-installation Setup and Configuration (Moderator: Dave Greenberg) »
  • Fatal Error: Out of memory - During Synchronization

This forum was archived on 2017-11-26.