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 CiviMember (Moderator: Deepak Srivastava) »
  • Deleting a membership record takes a long time, then results in a 500 error
Pages: [1]

Author Topic: Deleting a membership record takes a long time, then results in a 500 error  (Read 857 times)

jmickela

  • I post occasionally
  • **
  • Posts: 33
  • Karma: 0
  • CiviCRM version: 4.1.1
  • CMS version: Drupal 7
  • MySQL version: 5
  • PHP version: 5
Deleting a membership record takes a long time, then results in a 500 error
August 20, 2012, 01:57:29 pm
Any time I delete a membership record the page hangs for a long time then I get a 500 error. The record is deleted.

If I select more than one record to delete then only one will be deleted and I will still get the 500 error.

One thing I just noticed, I get a huge number of "CiviCRM contact not found" errors while the delete process is running.
« Last Edit: August 20, 2012, 02:03:04 pm by jmickela »

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: Deleting a membership record takes a long time, then results in a 500 error
August 20, 2012, 02:56:02 pm
When you get a 500 error, usually an error message is stored in the server logs. Can you find that and post it?
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

jmickela

  • I post occasionally
  • **
  • Posts: 33
  • Karma: 0
  • CiviCRM version: 4.1.1
  • CMS version: Drupal 7
  • MySQL version: 5
  • PHP version: 5
Re: Deleting a membership record takes a long time, then results in a 500 error
August 20, 2012, 04:36:28 pm
Code: [Select]
/var/log/apache2/error.log < [Mon Aug 20 19:29:11 2012] [error] [client my-ip-address] PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 32 bytes) in /var/www/sites/all/modules/civicrm/api/v3/utils.php on line 282, referer: https://mysite.org/civicrm/contact/view/membership?reset=1&action=delete&id=11080&cid=18064&context=search&compContext=membership&key=d6cae9c703a78feb4c1a97fa681ac2a0_5277

I find it hard to believe that the simple act of deleting a membership would require more memory than anything else in the site does, especially when the membership record is actually getting deleted.

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: Deleting a membership record takes a long time, then results in a 500 error
August 20, 2012, 06:11:30 pm

what version r on? if not the latest, 4.1.x u should upgrade :)

do u have mysql query logging enabled? would be good to see what queries are being run and why

the biggest fear is that it is potentially deleting and/or updating other records due to some bug that it should not be touching

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

jmickela

  • I post occasionally
  • **
  • Posts: 33
  • Karma: 0
  • CiviCRM version: 4.1.1
  • CMS version: Drupal 7
  • MySQL version: 5
  • PHP version: 5
Re: Deleting a membership record takes a long time, then results in a 500 error
August 22, 2012, 12:26:17 pm
Upgrading isn't really an option right now.

As for the log, it's 7 megs.

It looks more like something that would happen during a cron run, tons of memberships are being removed and added, not just the one that was selected, hundreds, maybe a few thousand others.

jmickela

  • I post occasionally
  • **
  • Posts: 33
  • Karma: 0
  • CiviCRM version: 4.1.1
  • CMS version: Drupal 7
  • MySQL version: 5
  • PHP version: 5
Re: Deleting a membership record takes a long time, then results in a 500 error
August 22, 2012, 03:52:29 pm
I've started using watchdog to track down the error. This is the line in the membership deletion code that's timing out.

Code: [Select]
CRM_Utils_Hook::post( 'delete', 'Membership', $membership->id, $membership );

jmickela

  • I post occasionally
  • **
  • Posts: 33
  • Karma: 0
  • CiviCRM version: 4.1.1
  • CMS version: Drupal 7
  • MySQL version: 5
  • PHP version: 5
Re: Deleting a membership record takes a long time, then results in a 500 error
August 23, 2012, 03:18:05 pm
Code: [Select]
function civicrm_member_roles_civicrm_post($op, $objname, $objid, &$objref) {
    if ($objname == "Membership") {
        if (variable_get('civicrm_member_roles_sync_method', 0) == 3) {
            _civicrm_member_roles_sync(NULL, $objref->contact_id);
        }
    }
}

This is where the problem is coming from. I added watchdog statements to the beginning and end of this function and I can see that execution enters this function, but never leaves it.

jmickela

  • I post occasionally
  • **
  • Posts: 33
  • Karma: 0
  • CiviCRM version: 4.1.1
  • CMS version: Drupal 7
  • MySQL version: 5
  • PHP version: 5
Re: Deleting a membership record takes a long time, then results in a 500 error
August 23, 2012, 05:24:31 pm
Ok, it looks like _civicrm_member_roles_sync is processing all memberships because $objref->contact_id is null.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviMember (Moderator: Deepak Srivastava) »
  • Deleting a membership record takes a long time, then results in a 500 error

This forum was archived on 2017-11-26.