Subject Re: [Firebird-Java] reuse of connection after failure.
Author Roman Rokytskyy
> Just a general comment. The transaction in this case is not on the connection being closed, but on the temporary connection being used to attempt to recover a transaction in limbo during an XA rollback request. The Jaybird driver is closing the temporary connection in a finally of the tryCompleteInLimboTransaction() method shown below. (see 1. >>>>) The code looks as though it is attempting to commit any active transaction on the temporary connection. It then calls destroy. The fact that Firebird is returning the error means that the connection is active. It looks as though something goes badly wrong in the recover and that the connection throws an exception in the commit or the connection looses its knowledge of the active transaction, because the first time it knows of the transaction is after firebird returned the error( see 2. >>>>). The destroy method checks for active transactions and it does not fail there (see 3).

All correct. The ManagedConnection.destroy() throws an
IllegalStateException, since the resource manager should have finished
the transactions before. But that's not our case.

> My guess if I look through my code is that we where trying to rollback an already finished transaction, but I am not 100% certain that this is the case.

Yup. That's exactly what I am thinking about, though I want to confirm
it. I will check whether we can rewrite the code to get more information
about the execution path.

Roman