I changed the first program to start the database embedded, got an 
EmbeddedXADataSource, and did the same test.  I then connect to the database 
use SquirrelSQL embedded as well and the database insert that was never 
prepared is not present in the database.   It seems that this is from a 
rollback on System.exit(1) but cannot tell as it could be a rollback on the 
next startup of the database I supposed.


From: Katherine Marsden [mailto:[email protected]]
Sent: Friday, March 25, 2016 5:39 PM
To: [email protected]
Subject: Re: Need help with clearing a XA transaction ! Important

On 3/25/2016 12:35 PM, Bergquist, Brett wrote:
Shutdown would not work.   It was hung on the shutdown as well.   Actually the 
time to recover is going to be 50 hours which we don’t have.   We have had to 
go back to a backup of the database two days ago since the backup of the 
database done last night also contained these log files.

What about transactions that are not prepared?   I think this is a hole here.   
If an application were to  xa-start, execute some SQL, xa-end, but never 
xa-prepare and the application fails (crash), the transaction remains in Derby. 
 If the transaction required locks, then those also remained locked.   So what 
is ever going to clean that up.  The XAResource.recover never sees those 
transactions.

Again, it's been a long time, but I think when the session ends the transaction 
should roll back.  That is why I was curious if you saw the same behavior with 
your simple repro with Embedded.  I am guessing with embedded, the connection 
and the transaction goes away on System.exit() in the first program.   My guess 
is that Network Server is not cleaning up the session and so the transaction 
sticks around.  I wouldn't be surprised if there were that kind of connection 
cleanup issue with Network Server.  With your simple case, does runtimeinfo 
show the session still active?

Kathey




________________________________
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).

Reply via email to