0

We have a Magento 2.3.2 CE instance running and it has been working for us for a while without issue. Recently our products stopped saving and instead starting throwing the Asymmetric transaction rollback error.

The only error being logged is the reference to the error line (Magento/Framework/DB/Adapter/Pdo/Mysql.php:324) without any further information.

I tried all the suggestions and fixes I could think of (or find online), including:

  • Full Reindex (completed successfully)
  • Cleared Cache (cache:flush, cache:clean)
  • Manually removed generated,var/page_cache,var/cache
  • Changed indexers to run on schedule rather than save
  • Verified search engine (elasticsuite) is running
  • Changed search engine to MySql
  • Ran the setup:upgrade and setup:static-content:deploy commands

After I tried these things and none of them changed, or fixed the error delved into the Magento code. After adding some logging and following the error through the logic I determined the error is being thrown due to a transaction being rolled back multiple times.

I was able to get my products to save again by changing:

public function rollBack()
{
    if ($this->_transactionLevel === 1) {
        $this->logger->startTimer();
        parent::rollBack();
        $this->_isRolledBack = false;
        $this->logger->logStats(LoggerInterface::TYPE_TRANSACTION, 'ROLLBACK');
    } elseif ($this->_transactionLevel === 0) {
        throw new \Exception(AdapterInterface::ERROR_ASYMMETRIC_ROLLBACK_MESSAGE);
    } else {
        $this->_isRolledBack = true;
    }
    --$this->_transactionLevel;
    return $this;
}

to

public function rollBack()
{
    if ($this->_transactionLevel === 1) {
        $this->logger->startTimer();
        parent::rollBack();
        $this->_isRolledBack = false;
        $this->logger->logStats(LoggerInterface::TYPE_TRANSACTION, 'ROLLBACK');
    } elseif ($this->_transactionLevel === 0) {
        throw new \Exception(AdapterInterface::ERROR_ASYMMETRIC_ROLLBACK_MESSAGE);
    } else {
        //changed to false to allow products to save - NOT SURE OF SCOPE OF THIS CHANGE
        $this->_isRolledBack = false;
    }
    --$this->_transactionLevel;
    return $this;
}

Does anyone know what could be causing the problem originally, why this change has seemed to fix the issue for now, and if there are any (negative) side effects of making the change?

0

You should run this command to turn on the dev mode:

bin/magento deploy:mode:set developer 

Then it will show the errors.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.