Campaign Emails Very Slow Processing

Good Evening,

Has anyone dealt with this error message before with campaigns? Our emails have still been sending, but every email gets the error below tagged in the log files. Our campaigns used to be really quick and now they barely trickling out. We used to see the error below every now and then, but now it has filled our entire log file.

Sugar 9.0.2 Spring 19 Profession

Error acquiring lock for the emailman entry, skipping email delivery. lock status=0 Array

Parents
  • Hi Dan,

    The message you receive comes from the following block of code in ./moduels/EmailMan/EmailManDelivery.php:

              //acquire a lock.
              //if the database does not support repeatable read isolation by default, we might get data that does not meet
            //the criteria in the original query, and we care most about the in_queue_date and process_date_time,
            //if they are null or in past(older than 24 horus) then we are okay.

              $lock_query="UPDATE emailman SET in_queue=1, in_queue_date=". $db->now()." WHERE id = ".intval($row['id']);
              $lock_query.=" AND (in_queue ='0' OR in_queue IS NULL OR ( in_queue ='1' AND in_queue_date <= " .$db->convert($db->quoted($timedate->fromString("-1 day")->asDb()),"datetime")."))";

              //if the query fails to execute.. terminate campaign email process.
              $lock_result=$db->query($lock_query,true,'Error acquiring a lock for emailman entry.');
              $lock_count=$db->getAffectedRowCount($lock_result);

              //do not process the message if unable to acquire lock.
              if ($lock_count!= 1) {
                   $GLOBALS['log']->fatal("Error acquiring lock for the emailman entry, skipping email delivery. lock status=$lock_count " . print_r($row,true));
                   continue;  //do not process this row we will examine it after 24 hrs. the email address based dupe check is in place too.
              }

    For Sugar instances configured with MySQL, the default is to support repeatable read isolation. I recommend having your DBA investigate whether this is still the setting. Another possibility is that you have competing cron jobs attempting to process Sugar's schedulers.

    I hope this helps!

    Chris

Reply
  • Hi Dan,

    The message you receive comes from the following block of code in ./moduels/EmailMan/EmailManDelivery.php:

              //acquire a lock.
              //if the database does not support repeatable read isolation by default, we might get data that does not meet
            //the criteria in the original query, and we care most about the in_queue_date and process_date_time,
            //if they are null or in past(older than 24 horus) then we are okay.

              $lock_query="UPDATE emailman SET in_queue=1, in_queue_date=". $db->now()." WHERE id = ".intval($row['id']);
              $lock_query.=" AND (in_queue ='0' OR in_queue IS NULL OR ( in_queue ='1' AND in_queue_date <= " .$db->convert($db->quoted($timedate->fromString("-1 day")->asDb()),"datetime")."))";

              //if the query fails to execute.. terminate campaign email process.
              $lock_result=$db->query($lock_query,true,'Error acquiring a lock for emailman entry.');
              $lock_count=$db->getAffectedRowCount($lock_result);

              //do not process the message if unable to acquire lock.
              if ($lock_count!= 1) {
                   $GLOBALS['log']->fatal("Error acquiring lock for the emailman entry, skipping email delivery. lock status=$lock_count " . print_r($row,true));
                   continue;  //do not process this row we will examine it after 24 hrs. the email address based dupe check is in place too.
              }

    For Sugar instances configured with MySQL, the default is to support repeatable read isolation. I recommend having your DBA investigate whether this is still the setting. Another possibility is that you have competing cron jobs attempting to process Sugar's schedulers.

    I hope this helps!

    Chris

Children
No Data