Hey, i have no idea what this error message is about:

Error
DatabaseTransactionOutOfOrderException: in DatabaseConnection->rollback() (regel 1049 van /home/users/path/includes/database/database.inc).

Fatal error: Uncaught exception 'DatabaseTransactionNoActiveException' in /home/users/loopsftp/loopfietsstore.com/includes/database/database.inc:1100 Stack trace: #0 /home/users/loopsftp/loopfietsstore.com/includes/database/database.inc(1872): DatabaseConnection->popTransaction('savepoint_1') #1 [internal function]: DatabaseTransaction->__destruct() #2 {main} thrown in /home/users/path/includes/database/database.inc 

i'm getting it when adding a product to the basket. It get's even stranger: when refreshing the page a couple of times the error disappears and doesn't come back. It must be in a way session related because in 'fresh' browser you get same problem... Help?

Comments

rszrama’s picture

Are you on Drupal 7.8?

muschpusch’s picture

yes!

rszrama’s picture

Status: Active » Postponed (maintainer needs more info)

I don't suppose you're still getting this error or have found a fix? I've still never seen the error.

You might also provide other helpful information about your installation - i.e. MySQL version, contributed modules, etc.

muschpusch’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)

I have no idea why but the error disappeared.

rszrama’s picture

Weird, but glad to hear it. : )

geek-merlin’s picture

for reference: the coupon fix in #1315022: Emptying cart with coupon applied throws error made me happy with this

murz’s picture

Sometimes I got the same error when users do the order (about 1 time for 50 orders). If I try to reproduce this error with same order, it isn't reproduced. So seems this issue is related to browser or cookie (maybe specific commerce cart actions) on client side.
I don't use Commerce Coupon module, Commerce is 1.3 version.

soundexcel’s picture

Status: Closed (cannot reproduce) » Active

I am getting this error in combination with the commerce_discount module.
The following error from the commerce_discount module:
Notice: Undefined index: discount_name in commerce_discount_remove_discount_components()
See the issue
(unfortunately the patch is not working, but i am looking in to this).

This generates the error mentioned above:
DatabaseTransactionOutOfOrderException: in DatabaseConnection->rollback() (line 1042

The error is generated when adding a product to the cart. A pricing rule is used with a product variation field as discount parameter. When selecting "base price" everything works perfect, but the discount does not show in the cart overview.

rszrama’s picture

Status: Active » Closed (cannot reproduce)

The error seems to be related to that module, so no need to reopen a duplicate issue here.

luksak’s picture

Version: 7.x-1.0 » 7.x-1.x-dev
Status: Closed (cannot reproduce) » Active

I am getting this error quite often now. I am not using commerce_discount.

rszrama’s picture

Version: 7.x-1.x-dev » 7.x-1.0
Status: Active » Closed (cannot reproduce)

This issue is so old I doubt it can be the same one as initially reported. I do believe there is still an open issue pertaining to database transactions, so I'm going to close this one out. You might also look in the core Drupal queue.

luksak’s picture

Project: Commerce Core » Commerce Discount
Version: 7.x-1.0 » 7.x-1.x-dev
Component: Cart » Code
Status: Closed (cannot reproduce) » Closed (fixed)

I ran into this issue again and tried updating Commerce Discounts again and this time the issue was resolved.

erik.johansson’s picture

Issue summary: View changes

I've created a new discount where you get one product for free when you purchase a certain amount of a certain product. First I add one of the required product to the cart and when I update the quantity of that product in the cart I get the following error:

DatabaseTransactionOutOfOrderException: in DatabaseConnection->rollback() (line 1061 of includes/database/database.inc)

I've backtracked this to when the save method is being performed in commerce_order.controller.inc.
This does not occur when the discount condition is not fulfilled.

erik.johansson’s picture

Status: Closed (fixed) » Active
wangxb07’s picture

Did you install and enable the commerce_addressbook module?

/**
 * Implements hook_commerce_order_insert().
 */
function commerce_addressbook_commerce_order_insert($order) {
 ....
}

This hook impelements maybe is the cause.

erik.johansson’s picture

No. We don't use the commerce_addressbook module.

gregory_kapustin’s picture

I still have this error, though i disabled commerce_adressbook module.

DatabaseConnection->rollback() (line 1058 in /srv/apps/events/event/includes/database/database.inc).

FO’s picture

I have the same problem...
DatabaseConnection->rollback() (line 1061 in...

It seems this problem appears after setting a pricing rule. The price is multiplied by 0.7 if user role is Revendeur.
The price are correctly calculated but impossible to add a product in the cart.
Delete the rule don't change anything !
The problem is solved after disabling commerce_discount...

My drupal core is 7.33 and commerce kickstart version is 7.x-2.19..

Same result with dev version of commerce_discount...

This said, the "revendeur" price is calculated correctly without commerce_discount... so...

steve.m’s picture

This may have nothing to do with discounts. I found this thread while searching for inexplicable DatabaseTransactionOutOfOrderException errors on saving an order.

It seems that the save() method in commerce_order.controller.inc calls an unncecessary $transaction->rollback() if the parent::save fails. It's redundant because parent::save itself does a rollback. Thus calling another one trips the if ($rolled_back_other_active_savepoints) condition in database.inc.

What this means is that the DatabaseTransactionOutOfOrderException error is masking another error that is therefore not being logged.

joelpittet’s picture

I had this and it was because I was modifying the order_number through a rule but didn't check for duplicates and it was doing an integrity violation then rolling back.

maciej.zgadzaj’s picture

Just faced the same issue. In our case the problem was with saving decimals to postgres integer fields. tailing postgres log has shown nice error message ERROR: invalid input syntax for integer: "333.33333333333" at character 246. Fixing it made the error go away. Just my $.02...

joelpittet’s picture

Project: Commerce Discount » commerce_addressbook
Version: 7.x-1.x-dev »

Patch seems to be against commerce_addressbook so moving back.

rszrama’s picture

Project: commerce_addressbook » Commerce Addressbook
Version: » 7.x-2.x-dev
mglaman’s picture

Status: Active » Closed (won't fix)

So, I'm just closing this. There's so many comments of users who probably landed here via Google trying to find an answer to this crazy error (which I don't blame any of them.) It's old and who knows its root cause.

Please, if you come here have specific error logs or MySQL logs that point to a query related to this module.

hiramanpatil’s picture

Hi,

I have added product into the cart and clicked on Proceed to checkout button. I am getting same error on /chechkout page.

DatabaseTransactionOutOfOrderException: in DatabaseConnection->rollback() (line 1061 of /path/to/project/includes/database/database.inc).

I am using Drupal 7.39 with commerce version 7.x-1.8.

Anybody has solved this issue?

wesleymusgrove’s picture

Thank you @joelpittet for #20!!! I forget that this always happens to me when I copy down my production database to my development environment, where I'm saving over order numbers with different order numbers generated by a 3rd party fulfillment API. The 3rd party's dev API always sends back order numbers that already exist in the production data, so when it tries to save an order number that already exists, it blows up. This DatabaseTransactionOutOfOrderException isn't exactly super helpful at telling me that, though.

BD3’s picture

Anyone else Google-ing this issue, mine ended up being an issue with Commerce Message where I had a custom rule sending emails out when an admin message was left on the order. I had to set the ""Send Message with Message notify"" to FALSE on "Save on Success/Fail" in the custom rule and the error went away.