It turns out this bug can also cause data corruption.

If the exception causing the first transaction to abort is not database
related, then the failing transaction is committed. Committing a half
completed transaction on an exception is a sure way to violate data
integrity.

It appears the problem in both cases is that transactions are marked
dirty too late. It is possible to get an exception between the point
where the transaction really becomes dirty and the point where the db
layer actually marks the transaction dirty. In that case upon exiting
@commit_on_success, the transaction is neither committed nor rolled
back. Instead it is reused for the next @commit_on_success, and if that
commits successfully, the partial transaction is committed.

One way the data corruption can be triggered is through a combination of
bug 1238559 and bug 1100758.

I'm starting to wonder if this bug might actually be in the django db
layer rather than in psycopg2.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1238559

Title:
  Exception causes next transaction to abort

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/psycopg2/+bug/1238559/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to