Description
Here is the code for commitTransaction:
public void commitTransaction(PersistenceManager pm) { Transaction currentTransaction = pm.currentTransaction(); try { Preconditions.checkState(currentTransaction.isActive(), "Transaction is not active"); currentTransaction.commit(); } finally { pm.close(); } }
so it does pm.close() in the finally clause, so it always closes pm.
Now everyone else does something like
commitTransaction(pm); rollbackTransaction = false; return roles; } finally { if (rollbackTransaction) { rollbackTransaction(pm); } }
which means that pm is closed by the time we call rollbackTransaction() and we never rollback when commit fails. As a result rollback is deferred till connection close (which may be some time due to connection pooling) and we are potentially holding various locks for longer than needed.
Attachments
Issue Links
- blocks
-
SENTRY-872 Uber jira for HMS HA + Sentry HA redesign
- Resolved
- is blocked by
-
SENTRY-1500 Sentry should use Datanucleus version of javax.jdo
- Resolved
-
SENTRY-1501 SentryStore shouldn't synchronize openTransaction() and commitUpdateTransaction()
- Resolved
- relates to
-
SENTRY-1422 JDO deadlocks while processing grant while a background thread processes Notificationlogs
- Resolved