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) »
  • CiviMail sent mailing to every member twice
Pages: [1]

Author Topic: CiviMail sent mailing to every member twice  (Read 1358 times)

mhenning

  • Guest
CiviMail sent mailing to every member twice
May 18, 2010, 11:29:02 am
Hi,

I just sent out a mailing that went to 866 recipients, but each one got 2 emails.  On the report screen for this mailing in the Delivery Summary section, the Intended Recipients is 1728, or twice the 866.  In the Recipients section it says Included: Members of "Member Mailing List", and when I click on that link it has the 866 number. 

When I go to Delivery Summary: Succesful Deliveries link, it shows every member there twice, and shows that it went through the list one time and then when done wen through it a second time.

I am concerned that this will happen again when I sent another email to the same group. 

Any suggestions on how to debug what happened to insure that it won't happen again?

mhenning

  • Guest
Re: CiviMail sent mailing to every member twice
May 20, 2010, 02:24:03 pm
Ok, here is what I think happened:

We have the mailing cronjob set to run every 5 minutes.  We had 2 mailings scheduled to go out at 9:00.
The 9:00 cronjob started the first mailing which took 8 minutes, and then at 9:08 sent the second mailing.

But, a second cronjob ran at 9:05 and saw that the second mailing hadn’t been started yet (since it didn’t start until 9:08), so it sent it out.

Net result is the second mailing got sent twice.

Can someone confirm this, and if this is correct, file a bug for it?

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: CiviMail sent mailing to every member twice
May 20, 2010, 02:37:33 pm

when a "process" (whether cron or via browser) is sending a mailing, it basically acquires a DB lock on the job in the database

thus in the below scenario, what should have happened is the first cron job should skip the second mailing, since it would not be able to get a lock on it

However (i'm thinking of scenarios here), if the second cron job finished and relinquished the lock before the first cron job's request timed out (we use a 1 second timeout wait), the first cron job could potentially resend the mailing. the chances of this happening are fairly low (but still significantly greater than 0, IMO)

What needs to happen, is once we get the lock, we refetch the job record from the DB and test and make sure it is still scheduled or running. We then operate on it with the new values. This will close the above potentially small but greater than zero hole

thoughts?

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

mhenning

  • Guest
Re: CiviMail sent mailing to every member twice
May 20, 2010, 02:43:38 pm
>> if the second cron job finished and relinquished the lock before the first cron job's request timed out (we use a 1 second timeout wait), the first cron job could potentially resend the mailing.

I don't understand why this window would be so small.  In my example, lets say the second mailing took 1 minute.  The second cron would be done at 9:06 and release the lock.  The first cron (which is running continuously from 9:00) would attempt to send the mailing at 9:08, not see a lock and send it.

Or am I missing something?

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: CiviMail sent mailing to every member twice
May 20, 2010, 02:48:19 pm

you are right and basically your logic makes the probability of it happening even more :)

if you can file an issue, i can work on the patch. if you can think of how to test this scenario, that would be great, so we know the patch works

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

mhenning

  • Guest
Re: CiviMail sent mailing to every member twice
May 20, 2010, 02:56:13 pm
Issue filed: http://issues.civicrm.org/jira/browse/CRM-6285

I don't really understand how the mailing cron process works, but could the first cron put a lock on all mailings that it is going to fire off?

Then the second cron would see a lock and do nothing.  I think this is better as I believe you want to have all mailings go one at a time and you don't want the second cron to set a second mailing going at the same time.

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: CiviMail sent mailing to every member twice
May 20, 2010, 03:04:07 pm

you might want to try this patch and see if u can simulate the previous scenario and test it out.

http://paste2.org/p/841205

Note that locking at the job level allows organizations to have multiple jobs run in parallel thus increasing speed/thruput etc. A large part of the time spent is on the network connection to the SMTP server and hence this is quite useful, IMO

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 »
  • Using CiviMail (Moderator: Piotr Szotkowski) »
  • CiviMail sent mailing to every member twice

This forum was archived on 2017-11-26.