Announcement Announcement Module
Collapse
No announcement yet.
Deadlock and rollback errors Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Deadlock and rollback errors

    We are using spring to manage our transactions and using Hibernate with it. We are also using a pessimistic retrier that will retry a method is there is a deadlock error.

    The problem I think I am seeing is that Object A executes a method that runs into a deadlock on the database. A
    PessimisticLockingFailureException is thrown and the transaction is marked to
    rollback.

    Before the pessimisticLocking Retrier can clear the rollback so other objects
    or processes can use the transaction, Object B tries to execute a method that
    requires the transaction to not be marked for rollback.

    Though the pessimisticLocking Retrier might clear the rollback it was not quick
    enough to do it before Object B tried to execute its method. So the program
    would throw a rollback error.

    I tried to apply PROPAGATION_REQUIRES_NEW to some of the methods and that seems to clear up the rollback problem, but it introduces a new problem.

    We get the following error every so often:

    PreparedStatementCallback; SQL [insert into acl_entry (acl_object_identity,
    ace_order, sid, mask, granting, audit_success, audit_failure)values (?, ?, ?,
    ?, ?, ?, ?)]; Cannot add or update a child row: a foreign key constraint fails
    (`rightspro/acl_entry`, CONSTRAINT `acl_entry_ibfk_1` FOREIGN KEY
    (`acl_object_identity`) REFERENCES `acl_object_identity` (`id`)); nested
    exception is java.sql.BatchUpdateException: Cannot add or update a child row: a
    foreign key constraint fails (`rightspro/acl_entry`, CONSTRAINT
    `acl_entry_ibfk_1` FOREIGN KEY (`acl_object_identity`) REFERENCES
    `acl_object_identity` (`id`))

    I am guess this is because one of our methods is holding an id to an acl_object_identity that is deleted during a roll back.

    Is there any way to isolate transactions so that they can rollback without affecting other sort of like nesting so that the pessimistic locking retrier can complete what it needs to and then continue on normally?
Working...
X