-
Notifications
You must be signed in to change notification settings - Fork 9.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rolled back transaction has not been completed correctly" on Magento 2.1.15 #18752
Comments
Hi @adammprost. Thank you for your report.
Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:
where @adammprost do you confirm that you was able to reproduce the issue on vanilla Magento instance following steps to reproduce?
|
I'm running into this issue as well after updating from Magento 2.1.15 to 2.2.6. Here's a stack trace that triggers the error in my production server (tested it first on acceptance, but there this issue doesn't happen :-/):
|
@adammprost : did you found a (temporary) solution to this problem? |
I found the issue in my case: I set the customer date of birth on the quote object, but the format was incorrect. If anyone else bumps into this issue: your problem might be something else. This error (with a very generic "something went wrong" message and not a very clear stack trace) is caused if a transaction has been rolled back and is being re-opened later on. The easiest way to debug this is by checking what process is triggering you
However, I do agree with @adammprost his comment that this setup can lead to some nasty situations that are difficult to debug. |
Hi @engcom-backlog-nazar. Thank you for working on this issue.
|
@engcom-backlog-nazar Thank you for verifying the issue. Based on the provided information internal tickets |
Hi! Any progress for this issue? Client said that he got a lot of messages from customers regarding this issue. I think it's urgent because when customers get 'An error has occurred on the server..', they don't know what they should do. |
Has anyone found a temporary solution to this? Still having problems when placing an order. |
I find out how to reproduce it:
To solve it, check in your code where those kind of exceptions are happening and fix it. |
I also had this issue after migrating from Magento 1.9.3 to Magento 2.3. Not sure how to fix it. Is there an update or quick fix to this one? Thank you!! |
Github Issue: magento#18752 If an exceptions happens in orderManagement->place($order) or an "sales_model_service_quote_submit_success" observer, the catch block itself fires an event that currently fails for guest checkouts in Magento\CatalogInventory\Model\ResourceModel\Stock->correctItemsQty(). This second exception hides the root exception and is logged to the exception log with the message "Rolled back transaction has not been completed correctly". This is not bound for this observer, but may occur in every other observer that is currently register or may be registered in the future. Therefore the failure event is wrapped in a try-catch itself and throws a combined exception that is logged in the exception.log.
I don't understand this error An exception occurred on 'sales_model_service_quote_submit_failure' event: Rolled back transaction has not been completed correctly. |
you used the first commit on this issue. I just added a second commit and created the pull request - try to use these changes. The error message a stack trace you provide just shows the consecutive exception, that happens in The |
I upgraded from 2.1.10 to 2.2.7 and this started happening. It would only happen when there was a payment decline. I am using the authorize.net payment gateway from paradox labs. I am not sure it's related but the exception being caught that causes this error is a message from that module. You can replicate it by making a payment using CC: 4444333322221111 CVV:111 EXP:0120. Now for the fix. In /vendor/magento/module-checkout/Model/GuestPaymentInformationManagement.php Go to function savePaymentInformationAndPlaceOrder and comment out the following lines: //$salesConnection = $this->connectionPull->getConnection('sales'); //$salesConnection->commit(); //$salesConnection->rollBack(); I did a diff with the same file from 2.1.10 and it looks like the database transaction code did not exist in that file so it is something new that was added causing the problem. For now, I just commented it out and everything works. |
Hi @adammprost. Thank you for your report.
The fix will be available with the upcoming 2.3.2 release. |
I'm seeing this issue in 2.3.4 when a credit card payment fails, as @rhoerr mentioned above:
Nested transactions aren't supported in mysql AFAIK. Here's my understanding of where it happens, from reading the 2.3.4 code:
So we have two issues:
Checked latest code, and it's fixed in 2.4.1 - see "MC-29426: Orders in Payment System but not in Magento" ( 43e41fa ) which fixed #25862 |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 14 days if no further activity occurs. Is this issue still relevant? If so, what is blocking it? Is there anything you can do to help move it forward? Thank you for your contributions! |
I am facing with this issue when I use custom payment. I don't know how to resolve this, can anyone know to help me? |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 14 days if no further activity occurs. Is this issue still relevant? If so, what is blocking it? Is there anything you can do to help move it forward? Thank you for your contributions! |
Hi @engcom-Hotel. Thank you for working on this issue.
|
Hi @adammprost We have tried to reproduce this issue in Magento 2.4-develop, but it seems that this issue has already been resolved. Please try to reproduce this issue in 2.4-develop branch. Please reply on this ticket if you are able to reproduce this issue in this branch. Thanks |
Hi @adammprost, It seems that your issue has been resolved. We are unable to get your response since 14 days, hence we are closing this issue for now. If you still facing the issue, you can reopen the ticket or create a new ticket. Thanks |
I encounter this issue on magento2.4.2, my reproduce steps are:
i do not know how to fix, help me please ! 1 exception(s): Exception #0 (Exception): Rolled back transaction has not been completed correctly. #1 Magento\Framework\DB\Adapter\Pdo\Mysql\Interceptor->___callParent() called at [vendor/magento/framework/Interception/Interceptor.php:138] #2 Magento\Framework\DB\Adapter\Pdo\Mysql\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153] #3 Magento\Framework\DB\Adapter\Pdo\Mysql\Interceptor->___callPlugins() called at [generated/code/Magento/Framework/DB/Adapter/Pdo/Mysql/Interceptor.php:32] #4 Magento\Framework\DB\Adapter\Pdo\Mysql\Interceptor->commit() called at [vendor/magento/framework/Model/ResourceModel/AbstractResource.php:93] #5 Magento\Framework\Model\ResourceModel\AbstractResource->commit() called at [vendor/magento/framework/Model/ResourceModel/Db/AbstractDb.php:426] #6 Magento\Framework\Model\ResourceModel\Db\AbstractDb->save() called at [vendor/magento/framework/Model/AbstractModel.php:655] #7 Magento\Framework\Model\AbstractModel->save() called at [vendor/magento/framework/Interception/Interceptor.php:58] #8 Magento\User\Model\User\Interceptor->___callParent() called at [vendor/magento/framework/Interception/Interceptor.php:138] #9 Magento\User\Model\User\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153] #10 Magento\User\Model\User\Interceptor->___callPlugins() called at [generated/code/Magento/User/Model/User/Interceptor.php:581] #11 Magento\User\Model\User\Interceptor->save() called at [vendor/magento/module-user/Controller/Adminhtml/User/Save.php:96] #12 Magento\User\Controller\Adminhtml\User\Save->execute() called at [vendor/magento/framework/Interception/Interceptor.php:58] #13 Magento\User\Controller\Adminhtml\User\Save\Interceptor->___callParent() called at [vendor/magento/framework/Interception/Interceptor.php:138] #14 Magento\User\Controller\Adminhtml\User\Save\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/framework/App/Action/Plugin/ActionFlagNoDispatchPlugin.php:51] #15 Magento\Framework\App\Action\Plugin\ActionFlagNoDispatchPlugin->aroundExecute() called at [vendor/magento/framework/Interception/Interceptor.php:135] #16 Magento\User\Controller\Adminhtml\User\Save\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153] #17 Magento\User\Controller\Adminhtml\User\Save\Interceptor->___callPlugins() called at [generated/code/Magento/User/Controller/Adminhtml/User/Save/Interceptor.php:23] #18 Magento\User\Controller\Adminhtml\User\Save\Interceptor->execute() called at [vendor/magento/framework/App/Action/Action.php:111] #19 Magento\Framework\App\Action\Action->dispatch() called at [vendor/magento/module-backend/App/AbstractAction.php:151] #20 Magento\Backend\App\AbstractAction->dispatch() called at [vendor/magento/framework/Interception/Interceptor.php:58] #21 Magento\User\Controller\Adminhtml\User\Save\Interceptor->___callParent() called at [vendor/magento/framework/Interception/Interceptor.php:138] #22 Magento\User\Controller\Adminhtml\User\Save\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/module-backend/App/Action/Plugin/Authentication.php:143] #23 Magento\Backend\App\Action\Plugin\Authentication->aroundDispatch() called at [vendor/magento/framework/Interception/Interceptor.php:135] #24 Magento\User\Controller\Adminhtml\User\Save\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153] #25 Magento\User\Controller\Adminhtml\User\Save\Interceptor->___callPlugins() called at [generated/code/Magento/User/Controller/Adminhtml/User/Save/Interceptor.php:32] #26 Magento\User\Controller\Adminhtml\User\Save\Interceptor->dispatch() called at [vendor/magento/framework/App/FrontController.php:186] #27 Magento\Framework\App\FrontController->processRequest() called at [vendor/magento/framework/App/FrontController.php:118] #28 Magento\Framework\App\FrontController->dispatch() called at [vendor/magento/framework/Interception/Interceptor.php:58] #29 Magento\Framework\App\FrontController\Interceptor->___callParent() called at [vendor/magento/framework/Interception/Interceptor.php:138] #30 Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153] #31 Magento\Framework\App\FrontController\Interceptor->___callPlugins() called at [generated/code/Magento/Framework/App/FrontController/Interceptor.php:23] #32 Magento\Framework\App\FrontController\Interceptor->dispatch() called at [vendor/magento/framework/App/Http.php:116] #33 Magento\Framework\App\Http->launch() called at [generated/code/Magento/Framework/App/Http/Interceptor.php:23] #34 Magento\Framework\App\Http\Interceptor->launch() called at [vendor/magento/framework/App/Bootstrap.php:263] #35 Magento\Framework\App\Bootstrap->run() called at [pub/index.php:29] |
How will fix that issue? Can you please explain? @josenacasabogiii |
Hi @savan13 I fixed it by checking the sales order table with some duplicate entries on some increment order id or something like that. You have to check your Magento error logs to point out the specific error because this error is triggered in many different ways when it comes to magento migration. It was luck fixing it on my because I just read some similar issues in in stack Magento exchange and it was long time ago and I can't remember what I specifically did. I'm not really a good Magento developer because I only worked on this platform a few times. Just let me know what you found on the errors maybe I can help a bit. Good luck! |
In error log shows this error: Can please look into this? |
@josenacasabogiii Hope you are doing well !! I have found that solution. |
Description
When a guest order is placed in Magento\Checkout\Model\GuestPaymentInformationManagement::savePaymentInformationAndPlaceOrder(), the following is executed: $salesConnection->beginTransaction(); $checkoutConnection->beginTransaction(), which creates a nested set of DB transactions (e.g. Magento\Framework\DB\Adapter\Pdo\Mysql::_transactionLevel exceeds 1).
Magento is built to handle nested DB transactions, but the way GuestPaymentInformationManagement is architected, it's almost guaranteeing a critical exception. When $this->savePaymentInformation() is executed, the _transactionLevel is already at 2, which means that any rollbacks triggered inside savePaymentInformation() will lead to a Magento\Framework\DB\Adapter\AdapterInterface::ERROR_ROLLBACK_INCOMPLETE_MESSAGE exception message thrown.
This is especially odd architecture when we compare it to synonymous class and method use for registered users: Magento\Checkout\Model\PaymentInformationManagement::savePaymentInformationAndPlaceOrder()
Preconditions (*)
Steps to reproduce (*)
Expected result (*)
Actual result (*)
The text was updated successfully, but these errors were encountered: