$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,
]
);
Forget (hey, everybody's got to learn) to add the attribute to the indexer
(http://magento.stackexchange.com/a/116462/14759)
Add/save a new Customer
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. Or even better yet, why the double declaration? The information in etc/indexer.xml is redundant so configuration for the indexer _could_ be extracted from the attribute configuration directly.
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.
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.
A Customer does get inserted into the database, but the frontend receive a "We can't save the customer." Exception. The logging isn't on any help (found the problem using xdebug and aspirine):
main.CRITICAL: Exception message: Asymmetric transaction rollback.
Trace: #0 /path/to/website/vendor/magento/framework/Model/ResourceModel/AbstractResource.php(99): Magento\Framework\DB\Adapter\Pdo\Mysql->rollBack()
#1 /path/to/website/var/generation/Magento/Customer/Model/ResourceModel/Customer/Interceptor.php(661): Magento\Framework\Model\ResourceModel\AbstractResource->rollBack()
#2 /path/to/website/vendor/magento/module-customer/Model/Plugin/CustomerRepository/TransactionWrapper.php(48): Magento\Customer\Model\ResourceModel\Customer\Interceptor->rollBack()
#3 /path/to/website/vendor/magento/framework/Interception/Interceptor.php(142): Magento\Customer\Model\Plugin\CustomerRepository\TransactionWrapper->aroundSave(Object(Magento\Customer\Model\ResourceModel\CustomerRepository\Interceptor), Object(Closure), Object(Magento\Customer\Model\Data\Customer), '43cada06c777d87...')
#4 /path/to/website/var/generation/Magento/Customer/Model/ResourceModel/CustomerRepository/Interceptor.php(26): Magento\Customer\Model\ResourceModel\CustomerRepository\Interceptor->___callPlugins('save', Array, Array)
#5 /path/to/website/vendor/magento/module-customer/Model/AccountManagement.php(710): Magento\Customer\Model\ResourceModel\CustomerRepository\Interceptor->save(Object(Magento\Customer\Model\Data\Customer), '43cada06c777d87...')
#6 /path/to/website/var/generation/Magento/Customer/Model/AccountManagement/Interceptor.php(141): Magento\Customer\Model\AccountManagement->createAccountWithPasswordHash(Object(Magento\Customer\Model\Data\Customer), '43cada06c777d87...', NULL)
#7 /path/to/website/vendor/magento/module-customer/Model/AccountManagement.php(662): Magento\Customer\Model\AccountManagement\Interceptor->createAccountWithPasswordHash(Object(Magento\Customer\Model\Data\Customer), '43cada06c777d87...', NULL)
#8 /path/to/website/var/generation/Magento/Customer/Model/AccountManagement/Interceptor.php(128): Magento\Customer\Model\AccountManagement->createAccount(Object(Magento\Customer\Model\Data\Customer), '123QWEasd', NULL)
#9 /path/to/website/vendor/magento/module-customer/Controller/Account/CreatePost.php(277): Magento\Customer\Model\AccountManagement\Interceptor->createAccount(Object(Magento\Customer\Model\Data\Customer), '123QWEasd', NULL)
#10 /path/to/website/var/generation/Magento/Customer/Controller/Account/CreatePost/Interceptor.php(24): Magento\Customer\Controller\Account\CreatePost->execute()
#11 /path/to/website/vendor/magento/framework/App/Action/Action.php(102): Magento\Customer\Controller\Account\CreatePost\Interceptor->execute()
#12 /path/to/website/vendor/magento/framework/Interception/Interceptor.php(74): Magento\Framework\App\Action\Action->dispatch(Object(Magento\Framework\App\Request\Http))
#13 /path/to/website/vendor/magento/framework/Interception/Chain/Chain.php(70): Magento\Customer\Controller\Account\CreatePost\Interceptor->___callParent('dispatch', Array)
#14 /path/to/website/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\\Custome...', 'dispatch', Object(Magento\Customer\Controller\Account\CreatePost\Interceptor), Array, 'storeCheck')
#15 /path/to/website/vendor/magento/module-customer/Controller/Plugin/Account.php(60): Magento\Customer\Controller\Account\CreatePost\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#16 /path/to/website/vendor/magento/framework/Interception/Interceptor.php(142): Magento\Customer\Controller\Plugin\Account->aroundDispatch(Object(Magento\Customer\Controller\Account\CreatePost\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#17 /path/to/website/var/generation/Magento/Customer/Controller/Account/CreatePost/Interceptor.php(39): Magento\Customer\Controller\Account\CreatePost\Interceptor->___callPlugins('dispatch', Array, Array)
#18 /path/to/website/vendor/magento/framework/App/FrontController.php(55): Magento\Customer\Controller\Account\CreatePost\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))
#19 /path/to/website/vendor/magento/framework/Interception/Interceptor.php(74): Magento\Framework\App\FrontController->dispatch(Object(Magento\Framework\App\Request\Http))
#20 /path/to/website/vendor/magento/framework/Interception/Chain/Chain.php(70): Magento\Framework\App\FrontController\Interceptor->___callParent('dispatch', Array)
#21 /path/to/website/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\\Framewo...', 'dispatch', Object(Magento\Framework\App\FrontController\Interceptor), Array, 'storeCheck')
#22 /path/to/website/vendor/magento/module-page-cache/Model/App/FrontController/VarnishPlugin.php(55): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#23 /path/to/website/vendor/magento/framework/Interception/Interceptor.php(142): Magento\PageCache\Model\App\FrontController\VarnishPlugin->aroundDispatch(Object(Magento\Framework\App\FrontController\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#24 /path/to/website/var/generation/Magento/Framework/App/FrontController/Interceptor.php(26): Magento\Framework\App\FrontController\Interceptor->___callPlugins('dispatch', Array, Array)
#25 /path/to/website/vendor/magento/framework/App/Http.php(135): Magento\Framework\App\FrontController\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))
#26 /path/to/website/vendor/magento/framework/App/Bootstrap.php(258): Magento\Framework\App\Http->launch()
#27 /path/to/website/index.php(39): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http))
#28 {main} [] []
@kweij thank you for your feedback.
Please specify Magento version used.
magento/product-community-edition, version 2.1.0
I solved the same error but in a different context following these steps:
From your website document root:
1) Do manual reindex:
php bin/magento indexer:reindex
2) Empty the cache:
rm -rf var/cache/*
rm -rf var/page_cache/*
rm -rf var/generation/*
3) Assign pemissions and ownership (eg.):
sudo chown user:www-data var/generation -R
sudo chmod 0775 var/generation -Rf
@kweij Does solution from @Dart18 help?
We are closing this issue because it hasn鈥檛 been updated in more than two weeks. If you can still reproduce this issue, please create a new GitHub issue report.
same problem!
I am having this same issue on Enterprise 2.1.3. From the admin I get "Asymmetric transaction rollback." from the API i receive"Unable to save product". However the product gets created/updated but exception is still being thrown meaning the rollback never occurs or is called post commit.
Most helpful comment
I am having this same issue on Enterprise 2.1.3. From the admin I get "Asymmetric transaction rollback." from the API i receive"Unable to save product". However the product gets created/updated but exception is still being thrown meaning the rollback never occurs or is called post commit.