Could someone take a look at the comment that I added for
https://issues.apache.org/jira/browse/DERBY-6879
Basically if we change the XATransactionState.run method to synchronize first
on the "xaState.conn" (ie. the EmbedConnection) first, then this problem does
not occur.
This is a very serious issue and happened again today in production. When
this issue happens, the system will continue to run but now transaction
recovery log files are created, thousands of them, because the transaction that
was going to be rolled back never is. The customer stopped the derby database
engine and restarted and recovery took about 4 hours for it to process the
transaction recover log files.
My proposed fix works I which I could acquire the lock on EmbedConnection
somehow like what is done:
/**
* Do not use this method directly use XATransactionState.xa_rollback
* instead because it also maintains/cancels the timout task which is
* scheduled to cancel/rollback the global transaction.
*/
public final void xa_rollback() throws SQLException {
synchronized (getConnectionSynchronization())
{
setupContextStack();
try
{
LanguageConnectionContext lcc = getLanguageConnection();
lcc.xaRollback();
InterruptStatus.restoreIntrFlagIfSeen(lcc);
} catch (StandardException t)
{
throw
handleException(t);
}
finally
{
restoreContextStack();
}
}
}
Here the code calls "getConnectionSynchronization" to get the synchronization
object but that method is not available from the outside world.
________________________________
Canoga Perkins
20600 Prairie Street
Chatsworth, CA 91311
(818) 718-6300
This e-mail and any attached document(s) is confidential and is intended only
for the review of the party to whom it is addressed. If you have received this
transmission in error, please notify the sender immediately and discard the
original message and any attachment(s).