Magento2: Asymmetric transaction rollback Exception overthrows SQL error, impedes debugging

Created on 21 Jun 2017  路  5Comments  路  Source: magento/magento2

Reopening https://github.com/magento/magento2/issues/6465

Preconditions

  1. Magento 2.1.4

Steps to reproduce

  1. Add an attribute to Customer and use it in grid, e.g.:
$this->eavSetup->addAttribute(
    Customer::ENTITY,
    'some_value',
    [
        'label' => 'Some value',
        'type' => 'varchar',
        'input' => 'text',
        'position' => 105,
        'sort_order' => 105,
        'visible' => true,
        'required' => false,
        'system' => false,
        'is_used_in_grid' => true,
    ]
);
  1. Forget (hey, everybody's got to learn) to add the attribute to the indexer
  2. Add/save a new Customer

Expected result

  1. The SQL error of the missing field in the customer_grid_flat table. Or maybe an Exception that let's me know that I intend to use a certain attribute in a grid but I forgot to add XML-configuration (etc/indexer.xml) for the indexer.

The main problem is that the rollback failed, so a Customer was added to the DB but an Exception was still thrown which replaced the actual SQL error, impeding debugging.

Actual result

  1. The method Magento\Customer\Model\Plugin\CustomerRepository\TransactionWrapper::aroundSave throws an Exception with a clear SQL error, however $this->resourceModel->rollBack() throws an Exception with the message "Asymmetric transaction rollback". I couldn't find out why.

So the real problem is that transaction rollback is overtrowing the ACTUAL error, making debugging near impossible.

Most helpful comment

@veloraven you never read the issue do you?
The problem is a random 'Asymmetric transaction rollback' error. I was just using #6465 as a reference. Anyhow, my hopes are set on #6497.

All 5 comments

And the other reason I am reopening this issue is because I have a cron that keeps giving an error with:

[Exception]
  Asymmetric transaction rollback.

cron:run [--group="..."] [--bootstrap="..."]

There is a PR in progress that may very well solve this https://github.com/magento/magento2/pull/9955 - can't promise - depends if your situation is being caused by a plugin. just re-read your post, you say it is a plugin....

@waynetheisinger tnx for the info. I have no idea where my 'Asymmetric transaction rollback' error is coming from so I hope yours will fix it :)

@PascalBrouwers thank you for your report but Customer custom attributes are available in Enterprise edition only.
If you use this one, please contact Magento support instead of posting your issue here.
If you use Community Edition please address your question at programming questions forum or Magento Stack Exchange.
I'm closing this issue: as it is not a native behavior of Magento CE and we can not treat it as an issue.

@veloraven you never read the issue do you?
The problem is a random 'Asymmetric transaction rollback' error. I was just using #6465 as a reference. Anyhow, my hopes are set on #6497.

Was this page helpful?
0 / 5 - 0 ratings