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 »
  • Installing CiviCRM »
  • CiviMail installation and configuration (Moderator: Donald Lobo) »
  • Mailing stuck in 'Running' mode
Pages: [1] 2

Author Topic: Mailing stuck in 'Running' mode  (Read 4441 times)

jimmyjam

  • I post occasionally
  • **
  • Posts: 87
  • Karma: 4
Mailing stuck in 'Running' mode
December 09, 2010, 01:53:10 pm
When I run this command from the command line:

Code: [Select]
wget 'http://my.org/sites/all/modules/civicrm/bin/civimail.cronjob.php?name=XXXX&pass=XXXX&key=XXXX'
... it changes the status of my scheduled mailing to 'Running', but no messages are sent. The mailing gets stuck and never completes.

To send the mailing, I have to run it manually using "http://<my.org>/civicrm/mailing/queue&reset=1", which sends the messages and changes the status to 'Complete'.

What am I doing wrong? Unfortunately, my server doesn't support cli, so I must use the webserver. I'm using Bluehost. I know it's a budget host, but CiviMail was working perfectly until I upgraded to 3.2.4, which broke the auto-mailer (or exposed a flaw in my configuration).

Thanks,
James

Martin.Schwenke

  • I post occasionally
  • **
  • Posts: 35
  • Karma: 0
  • CiviCRM version: 4.1.x
  • CMS version: Drupal 6.x
  • MySQL version: 5.1.x
  • PHP version: 5.3.x
Re: Mailing stuck in 'Running' mode
December 09, 2010, 03:05:31 pm
Quote from: jimmyjam on December 09, 2010, 01:53:10 pm
When I run this command from the command line:

Code: [Select]
wget 'http://my.org/sites/all/modules/civicrm/bin/civimail.cronjob.php?name=XXXX&pass=XXXX&key=XXXX'
... it changes the status of my scheduled mailing to 'Running', but no messages are sent. The mailing gets stuck and never completes.

To send the mailing, I have to run it manually using "http://<my.org>/civicrm/mailing/queue&reset=1", which sends the messages and changes the status to 'Complete'.

I'm seeing the same thing with CiviCRM 3.3.0.

I was using the CLI until 3.2.5 but in the upgrade to 3.3.0 something change so that the CLI will no longer work with my installation, which involves a few symlinks.  I can make the errors go away... but in this case the mailings never get out of "Scheduled" state.

Martin.Schwenke

  • I post occasionally
  • **
  • Posts: 35
  • Karma: 0
  • CiviCRM version: 4.1.x
  • CMS version: Drupal 6.x
  • MySQL version: 5.1.x
  • PHP version: 5.3.x
Re: Mailing stuck in 'Running' mode
December 09, 2010, 03:27:34 pm
Quote from: Martin.Schwenke on December 09, 2010, 03:05:31 pm
I'm seeing the same thing with CiviCRM 3.3.0.

Hmmm, I don't think this will help jimmyjam, but in 3.3.0 the issue sees to be with the child jobs:

mysql> select * from civicrm_mailing_job where mailing_id = 43;
+----+------------+---------------------+---------------------+----------+-----------+---------+----------+-----------+------------+-----------+
| id | mailing_id | scheduled_date      | start_date          | end_date | status    | is_test | job_type | parent_id | job_offset | job_limit |
+----+------------+---------------------+---------------------+----------+-----------+---------+----------+-----------+------------+-----------+
| 87 |         43 | 2010-12-10 10:20:01 | 2010-12-10 10:21:13 | NULL     | Running   |       0 | NULL     |      NULL |          0 |         0 |
| 88 |         43 | 2010-12-10 10:20:01 | NULL                | NULL     | Scheduled |       0 | child    |        87 |          0 |         0 |
+----+------------+---------------------+---------------------+----------+-----------+---------+----------+-----------+------------+-----------+
2 rows in set (0.00 sec)


The parent job is running but the child job is merely scheduled.  You can run the cron job many times but this doesn't change...  :-(

Doing the queue reset that jimmyjam suggests causes delivery to happen and for both parent/child to be marked as "Complete".  However, trying to delete the mailing fails with a foreign key issue, since the delete process seems to try to delete the parent before the child.  If I manually delete the child from the DB then I can delete the mailing through CiviCRM.  Oh, and I'm only trying to delete the mailing because it is a test...  ;-)

Martin.Schwenke

  • I post occasionally
  • **
  • Posts: 35
  • Karma: 0
  • CiviCRM version: 4.1.x
  • CMS version: Drupal 6.x
  • MySQL version: 5.1.x
  • PHP version: 5.3.x
Re: Mailing stuck in 'Running' mode
December 09, 2010, 04:02:01 pm
Just some more information...

My test mailing is going to a group containing a single individual.

I have Mailer Batch Limit set to 0.

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: Mailing stuck in 'Running' mode
December 09, 2010, 08:27:32 pm

hey martin:

the civicrm/mailing/queue calls the same function as the cron job. so a bit curious as to why the cronjob does not put the child job in running status and run the jobs. We (and emotive) have tried this on our local servers and all seems fine

can you debug the cronjob script and see what is happening and why. ping us on irc if u need help getting started

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

jimmyjam

  • I post occasionally
  • **
  • Posts: 87
  • Karma: 4
Re: Mailing stuck in 'Running' mode
December 09, 2010, 08:34:47 pm
I'm having the same issue as Martin. When I try to delete a test mailing, I receive the following error:

Code: [Select]
Sorry. A non-recoverable error has occurred.
DB Error: constraint violation
Error Details
Database Error Code: Cannot delete or update a parent row: a foreign key constraint fails (`ossnpcom_civicrmmanasd4`.`civicrm_mailing_job`, CONSTRAINT `parent_id` FOREIGN KEY (`parent_id`) REFERENCES `civicrm_mailing_job` (`id`)), 1451
Additional Details:
Array
(
    [callback] => Array
        (
            [0] => CRM_Core_Error
            [1] => handle
        )

    [code] => -3
    [message] => DB Error: constraint violation
    [mode] => 16
    [debug_info] => DELETE FROM civicrm_mailing  WHERE (  civicrm_mailing.id = 87 )  [nativecode=1451 ** Cannot delete or update a parent row: a foreign key constraint fails (`ossnpcom_civicrmmanasd4`.`civicrm_mailing_job`, CONSTRAINT `parent_id` FOREIGN KEY (`parent_id`) REFERENCES `civicrm_mailing_job` (`id`))]
    [type] => DB_Error
    [user_info] => DELETE FROM civicrm_mailing  WHERE (  civicrm_mailing.id = 87 )  [nativecode=1451 ** Cannot delete or update a parent row: a foreign key constraint fails (`ossnpcom_civicrmmanasd4`.`civicrm_mailing_job`, CONSTRAINT `parent_id` FOREIGN KEY (`parent_id`) REFERENCES `civicrm_mailing_job` (`id`))]
    [to_string] => [db_error: message="DB Error: constraint violation" code=-3 mode=callback callback=CRM_Core_Error::handle prefix="" info="DELETE FROM civicrm_mailing  WHERE (  civicrm_mailing.id = 87 )  [nativecode=1451 ** Cannot delete or update a parent row: a foreign key constraint fails (`ossnpcom_civicrmmanasd4`.`civicrm_mailing_job`, CONSTRAINT `parent_id` FOREIGN KEY (`parent_id`) REFERENCES `civicrm_mailing_job` (`id`))]"]
)
Return to home page.
[/code]

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: Mailing stuck in 'Running' mode
December 10, 2010, 06:54:47 am

The delete issue has two reason:

1. There is a bug in the upgrade script. We'll fix this in the 3.3.2 release

2. There is also a bug in mysql which is triggered in some releases (not in your  case)

http://bugs.mysql.com/bug.php?id=57255

Not a lot we can do if folks hit this bug

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

Martin.Schwenke

  • I post occasionally
  • **
  • Posts: 35
  • Karma: 0
  • CiviCRM version: 4.1.x
  • CMS version: Drupal 6.x
  • MySQL version: 5.1.x
  • PHP version: 5.3.x
Re: Mailing stuck in 'Running' mode
December 13, 2010, 02:33:20 am
Hi lobo,

Quote from: Donald Lobo on December 09, 2010, 08:27:32 pm
the civicrm/mailing/queue calls the same function as the cron job. so a bit curious as to why the cronjob does not put the child job in running status and run the jobs. We (and emotive) have tried this on our local servers and all seems fine

can you debug the cronjob script and see what is happening and why. ping us on irc if u need help getting started

Am I comparing CRM_Mailing_Page_Browse::run() in CRM/Mailing/Page/Browse.php to the cron job?  I'm trying to figure out what gets called from civicrm/mailing/queue.  I think I manage to drill down from civicrm_invoke() to CRM_Core_Invoke::invoke() but then I get lost.  :-(

Do you suggest a bucketload of printf's for debugging the cronjob or something more exciting?  :-)

Thanks...

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: Mailing stuck in 'Running' mode
December 13, 2010, 07:53:28 am

try the patch mentioned here:

http://forum.civicrm.org/index.php/topic,16569.msg72549.html#msg72549

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

Martin.Schwenke

  • I post occasionally
  • **
  • Posts: 35
  • Karma: 0
  • CiviCRM version: 4.1.x
  • CMS version: Drupal 6.x
  • MySQL version: 5.1.x
  • PHP version: 5.3.x
Re: Mailing stuck in 'Running' mode
December 13, 2010, 11:43:59 am
Quote from: Donald Lobo on December 13, 2010, 07:53:28 am
try the patch mentioned here:

http://forum.civicrm.org/index.php/topic,16569.msg72549.html#msg72549

Didn't help.  Will try to spend some time today debugging...

Martin.Schwenke

  • I post occasionally
  • **
  • Posts: 35
  • Karma: 0
  • CiviCRM version: 4.1.x
  • CMS version: Drupal 6.x
  • MySQL version: 5.1.x
  • PHP version: 5.3.x
Re: Mailing stuck in 'Running' mode
December 14, 2010, 02:29:56 am
OK, it looks to be about permissions.

CRM_Mailing_BAO_Job::runJobs() is the only function in Job.php that uses  {$mailingACL} in the query.  Some of the other functions set $mailingACL but do not use it.

If I remove that part of the query then the job runs to completion but no mail is sent.

I'm using an unprivileged user to run the cron jobs.  This has worked previously, although I may have hacked the cron script to say CRM_Utils_System::authenticateScript( false ) .  That doesn't seem to make a difference in this case... I just tried it.

Has security been improved so that only users with a particular CiviCRM permission can run the mail cron job?  If so, what are the minimum permissions I need to assign to the user that runs the cron job?

Note that I can still run the UpdateMembershipRecord.php cron job as an unprivileged user (and I like it that way  ;) )...

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: Mailing stuck in 'Running' mode
December 14, 2010, 06:08:27 am

we started bootstrapping drupal for cronjobs in 3.2 and hence now respect all ACL's U'll need to give your cron job user permissions to edit/view all contacts, so they can see all groups (and hence all mailings) and maybe even access CiviMail

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

messy

  • I’m new here
  • *
  • Posts: 11
  • Karma: 0
  • CiviCRM version: 4.05
  • CMS version: Drupal 7.7
  • MySQL version: 5.0.5
  • PHP version: 5.3.5
Re: Mailing stuck in 'Running' mode
December 14, 2010, 12:05:07 pm
Is there a workaround for folks stuck with a big mailing to go out? I've tried running mailing/queue?reset=1 but nothing happens...

Any help you could provide 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: Mailing stuck in 'Running' mode
December 14, 2010, 12:07:05 pm

yes, a bit earlier on the thread, there is a patch posted:

http://forum.civicrm.org/index.php/topic,16569.msg72549.html#msg72549

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

messy

  • I’m new here
  • *
  • Posts: 11
  • Karma: 0
  • CiviCRM version: 4.05
  • CMS version: Drupal 7.7
  • MySQL version: 5.0.5
  • PHP version: 5.3.5
Re: Mailing stuck in 'Running' mode
December 14, 2010, 12:13:41 pm
Thanks so much, Lobo. Now forgive my ignorance, but how do I apply it?

:D

Pages: [1] 2
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Installing CiviCRM »
  • CiviMail installation and configuration (Moderator: Donald Lobo) »
  • Mailing stuck in 'Running' mode

This forum was archived on 2017-11-26.