Skip to content

Rolled back transaction has not been completed correctly" on Magento 2.1.15 #18752

Closed
@adammprost

Description

@adammprost

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 (*)

  1. Magento 2.1.15
  2. PHP 7.0

Steps to reproduce (*)

  1. Configure any online payment method with sandbox credentials.
  2. Place a guest order with credit card details that trigger an error message from the payment processor.

Expected result (*)

  1. The customer is shown the "An error has occurred on the server.." message.
  2. The exception log is empty.

Actual result (*)

  1. The customer is shown the "An error has occurred on the server.." message.
  2. The exception log has a critical exception of "Rolled back transaction has not been completed correctly."

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions