Hi Gary, I reproduce it too in my Eclipse. I think it's a bug in the test.
The TransactionContext.transactionRef and the TransactionRegistry.caches are holding onto the Transaction (acquired in TransactionRegistry.getActiveTransactionContext()) only using weak refs. However in TestSynchronizationOrder the fake TransactionManager returns a Transaction (that's an instance of an anonymous class) but nobody holds a strong reference to that. I think that the fake TransactionManager should create the fake Transaction at begin() time, and hold onto it using a strong reference until commit() time. Florent On Tue, Dec 29, 2020 at 7:56 PM Gary Gregory <garydgreg...@gmail.com> wrote: > Hi All: > > I just saw on > > https://github.com/apache/commons-dbcp/runs/1622526568?check_suite_focus=true > > [INFO] Running org.apache.commons.dbcp2.managed.TestSynchronizationOrder > Error: Tests run: 2, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: > 0.088 s <<< FAILURE! - in > org.apache.commons.dbcp2.managed.TestSynchronizationOrder > Error: testInterposedSynchronization Time elapsed: 0.077 s <<< ERROR! > java.sql.SQLException: Unable to enlist connection because the transaction > has been garbage collected > at > > org.apache.commons.dbcp2.managed.TestSynchronizationOrder.testInterposedSynchronization(TestSynchronizationOrder.java:118) > > Is this random or a bug? > > Gary > -- [image: Nuxeo Logo] <https://www.nuxeo.com/> Florent Guillaume Head of R&D [image: LinkedIn] <https://www.linkedin.com/in/fguillaume/> [image: Twitter] <https://twitter.com/efge> [image: Github] <https://github.com/efge> Nuxeo Content Services Platform. Stay ahead.