After running transactions for several hours we're seeing strange behavior where unbind calls in TransactionSynchronizationManager begin to fail. The root of the failure appears to be the DataSource being switched somehow in the JpaTransactionManager. As the get and set methods in JpaTransactionManager don't have much logging I created a sub class to add additional logging.

LoggingJpaTransactionManager.txt

From what I see in the log sometime after the getDataSource here org.springframework.orm.jpa.JpaTransactionManager.doBegin(JpaTransactionManager.java:423)

And after the transaction synchronization clearing here o.s.t.s.TransactionSynchronizationManager[337] txid=0049cb3e-f76d-4cf8-a41f-4495adc3eddf: Clearing transaction synchronization

The DataSource is switched from net.ttddyy.dsproxy.support.ProxyDataSource@21280cbb to net.ttddyy.dsproxy.support.ProxyDataSource@7ed8b44

I'm not entirely sure how this is possible given there are no logs for setDataSource

Here is the log file. The events are ordered newest to oldest, sorry about this.

1628797549_573760_88EF00AB-3D62-4624-A314-1B7E606B9101.txt

Comment From: bwilsonPaychex

We've solved this issue with the following PR https://github.com/spring-projects/spring-framework/pull/27417