Unable to acquire lock!

pensareweb

New Member
I just updated to version 1.8.1.: when a campaign is sent to more than one list, the merge fails with this error Unable to acquire lock!

how can i solve?
 

twisted1919

Administrator
Staff member
Can you try to delete the mutex folder which is located in /apps/common/runtime/ folder?
Then try again?
This should fix your issue.
 

twisted1919

Administrator
Staff member
Do you use redis by any chance? If you do, then flush the redis database as well.
If none of these applies, disable the cron jobs and kill the php processes, then remove the mutexes once again, and try it manually.
If then it works, put back the cron jobs.
 

pensareweb

New Member
I did everything you requested (there is redis and it has been restarted) but the problem subsists. (done restart php, removed the cronjob, deleted mutex folder)
 
I wrote this as well, although with me on the Backend fetch failed error, when the list merged stopped and refresh the page
then he wrote this to me too: "Unable to acquire lock!".

besides, the list mergers don't stop writing it all the time.
 

Robin

New Member
Were you able to solve this? I am getting the same error (using Redis) when trying to send campaigns to multiple lists, following the steps suggested doesn't help. If I turn off Redis for mutexes I get this error message instead: "Unable to copy the campaign initial list."

In the latter case, the application log also says:
Code:
2019/09/18 19:27:04 [error] [system.db.CDbCommand] [x.x.x.x] CDbCommand::execute() failed: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`mailwizz_prod`.`mw_list_company`, CONSTRAINT `fk_customer_company_country100` FOREIGN KEY (`country_id`) REFERENCES `mw_country` (`country_id`) ON DELETE CASCADE ON UPDATE NO ACTION). The SQL statement executed was: INSERT INTO `mw_list_company` (`list_id`, `type_id`, `country_id`, `zone_id`, `name`, `website`, `address_1`, `address_2`, `zone_name`, `city`, `zip_code`, `phone`, `address_format`) VALUES (:yp0, :yp1, :yp2, :yp3, :yp4, :yp5, :yp6, :yp7, :yp8, :yp9, :yp10, :yp11, :yp12).
 

Robin

New Member
Were you able to solve this? I am getting the same error (using Redis) when trying to send campaigns to multiple lists, following the steps suggested doesn't help. If I turn off Redis for mutexes I get this error message instead: "Unable to copy the campaign initial list."
Problem partly solved - it now works without Redis activated (my lists didn't have a country set under Company details). I still want to use Redis though so it would be great to get some help with that use case.
 

twisted1919

Administrator
Staff member
@Megat ahmad mustaqim - for a quick fix, open the file /apps/customer/controllers/CampaignsController.php and look for this block of code:
PHP:
if (!Yii::app()->mutex->acquire($lockName, 30)) {
    if (Yii::app()->request->isAjaxRequest) {
        return $this->renderJson([
            'finished'      => true,
            'progress_text' => Yii::t('campaigns', 'Unable to acquire lock!'),
        ]);
    }
    Yii::app()->notify->addError(Yii::t('campaigns', 'Unable to acquire lock!'));
    return $this->redirect(array('campaigns/confirm', 'campaign_uid' => $campaign_uid));
}
And remove it. It's around line 1488
 
Top