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) »
  • UpdateMembershipRecord timing out
Pages: [1]

Author Topic: UpdateMembershipRecord timing out  (Read 2632 times)

lcdweb

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1620
  • Karma: 116
    • www.lcdservices.biz
  • CiviCRM version: many versions...
  • CMS version: Joomla/Drupal
  • MySQL version: 5.1+
  • PHP version: 5.2+
UpdateMembershipRecord timing out
December 31, 2008, 09:01:44 am
I'm running into a problem with UpdateMembershipRecord.php
It keeps timing out when run manually from a browser, and when I try to run from SSH/command line, it runs for a while and then terminates unexpectedly. My max_execution_time, max_input_time and memory_limit are plenty high (1800, 1800, 96m).

This is the first time I'm running it after a large import, so I'm not surprised that it would take some time, but I would have expected it would at least finish when run through SSH.

Any ideas?
support CiviCRM through 'make it happen' initiatives!
http://civicrm.org/mih

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: UpdateMembershipRecord timing out
December 31, 2008, 11:58:31 am

hey brian:

whats the error message when it terminates unexpectedly from the command line. It most likely is triggering a bug in some part of the code and hence the unexpected termination

You might want to consider modifying the script and processing a constant number of memberships per run. You might want to extend the script to take an offset and limit as parameters. Please publish your changes so we can incorporate in a future release :)

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

lcdweb

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1620
  • Karma: 116
    • www.lcdservices.biz
  • CiviCRM version: many versions...
  • CMS version: Joomla/Drupal
  • MySQL version: 5.1+
  • PHP version: 5.2+
Re: UpdateMembershipRecord timing out
December 31, 2008, 12:17:20 pm
No error. When running from SSH it just ends abruptly and says "terminated".
When running from http it stops with a blank screen.

I'll take a look at the suggestion for modifying it. I was thinking there might be a bug in the data that's triggering it to stop.
support CiviCRM through 'make it happen' initiatives!
http://civicrm.org/mih

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: UpdateMembershipRecord timing out
December 31, 2008, 12:23:04 pm

most likely this is your "hosting company" feature that probably terminates processes that take a long time or memory. A PHP or DB error would give you more details

i suspect processing a certain number of memberships per run is probably a good way of getting around this issue

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

lcdweb

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1620
  • Karma: 116
    • www.lcdservices.biz
  • CiviCRM version: many versions...
  • CMS version: Joomla/Drupal
  • MySQL version: 5.1+
  • PHP version: 5.2+
Re: UpdateMembershipRecord timing out
December 31, 2008, 02:16:29 pm
VPS, full root access. I had some conversations with Tech Support to see if there was something I was missing at their end, but I really shouldn't have these issues, especially if I'm running it from the command line.

But who knows. I manually segmented the query and the script completed. So it does appear as though the process is quitting because it's taking too long.

Questions about the script --
The script is set to ignore memberships with a Pending or Canceled status (unless the contact is deceased, in which case the status would be changed to Deceased). I guess the assumption is that those two statuses are manually changed. So one improvement may be to build that criteria into the query so that you start out working with a smaller data set. Seems like you could add "Expired" and "Deceased" to that criteria exclusion.

Though I'm not sure that's a good policy, as it sort of pre-determines the uses of those statuses outside of the interface.

Adding those criteria to the query dropped my resultset in half, and the script ran without a hitch.
support CiviCRM through 'make it happen' initiatives!
http://civicrm.org/mih

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: UpdateMembershipRecord timing out
January 01, 2009, 08:44:39 am
Brian - It may make sense to filter the query set using civicrm_membership_status.is_admin = 0. That flag is intended to mark statuses that aren't updated automatically. AND since the flag can be "configured" thru the admin interface - it would be flexible.

Would be great if you could think about this with reference to the various use cases you've seen / implemented. If you think it makes sense, you could write it up as an issue for 2.3 and submit a patch for it. (We would also need to look at updating the default config data to set that flag true for Pending and Cancelled in order to replicate the current behavior.)
Protect your investment in CiviCRM by  becoming a Member!

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: UpdateMembershipRecord timing out
February 03, 2009, 10:58:06 am
Hi,

One way of improving the result is to call it from the cli instead of from curl/wget. By bypassing the webserver, you really improve things, you can nice/ionice it on the cron, and in general it works much better memory or timeouting wise.

In the bin/cli.php you have a wrapper (on the trunk in svn, might be older) that makes it easy to call your code from the cli, and deals with parameters and key and this and that.

Ping me if you can't find your way or need an example of how to use.

X+
-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: UpdateMembershipRecord timing out
February 03, 2009, 11:52:27 am

a large part of the user base does not have shell access and thus we moved away from the cli approach. i suspect in the long run, we will need both a CLI and a web solution :)

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

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: UpdateMembershipRecord timing out
February 03, 2009, 12:23:06 pm
Hi,

I'm not saying that the cli should be the only solution, but that's fairly easy to have two wrappers (web request and cli) that access the same code once the the parsing of the params is done.

I'll try to do it on the mail cron, I've been complaining on it for too long about it.

To be continued...

X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviMember (Moderator: Deepak Srivastava) »
  • UpdateMembershipRecord timing out

This forum was archived on 2017-11-26.