I'm not sure about the following. I describe what I observe. I didn't debug it, because it went away after raising the memory_limit to 256MB (and there are still a lot of open tickets here :-()
We had the problem, that a memory_limit fatal error occured, this errors was "catched" by
\Varien_Db_Adapter_Pdo_Mysql::__destruct
public function __destruct()
{
if ($this->_transactionLevel > 0) {
trigger_error('Some transactions have not been committed or rolled back', E_USER_ERROR);
}
}
and because the transactionLevel > 0
the error was triggered, this error can be catched(?)... whatever...
It ended here in one of the ifs I think:
public function successAction()
{
$session = $this->getOnepage()->getCheckout();
if (!$session->getLastSuccessQuoteId()) {
$this->_redirect('checkout/cart');
return;
}
$lastQuoteId = $session->getLastQuoteId();
$lastOrderId = $session->getLastOrderId();
$lastRecurringProfiles = $session->getLastRecurringProfileIds();
if (!$lastQuoteId || (!$lastOrderId && empty($lastRecurringProfiles))) {
$this->_redirect('checkout/cart');
return;
}
In the end the order was written, the mail was send, but the cart was not cleared.
Turn on debug mode, then you see hopefully the
trigger_error('Some transactions have not been committed or rolled back', E_USER_ERROR);
And as I said, in our case, this was triggered by a low memory_limit.