You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm building an app using Spring Boot 2.1.3, Atomikos 4.0.6 and Oracle Database 11g. After timeout occurs, transaction doesn't rollback immediately, but instead continues on execution. Can anyone explain if it's the correct behaviour and I don't understand something or am I doing something wrong?
I added spring-boot-starter-jta-atomikos to my pom.xml and configured datasource as follows below. I don't explicitly configure anything else related to database like EntityManager or Hibernate properties. Also, I don't configure UserTransactionManager, UserTransactionImp, UserTransactionService and JtaTransactionManager explicitly. Can any of these be a problem?
@Configuration
public class MasterDbConfig {
@Primary
@Bean(initMethod = "init", destroyMethod = "close")
public AtomikosDataSourceBean masterDataSource() {
AtomikosDataSourceBean dataSource = new AtomikosDataSourceBean();
dataSource.setUniqueResourceName("MasterDBXAResource");
dataSource.setXaDataSourceClassName("oracle.jdbc.xa.client.OracleXADataSource");
dataSource.setBorrowConnectionTimeout(120);
dataSource.setMinPoolSize(3);
dataSource.setMaxPoolSize(30);
Properties xaProps = new Properties();
xaProps.put("URL", "jdbc:oracle:thin:@...:1521:...");
xaProps.put("user", "...");
xaProps.put("password", "...");
dataSource.setXaProperties(xaProps);
return dataSource;
}
}
Then I see the following in the log and I see the query executing in the database:
12-04-2019 12:09:48,985 INFO (XXX.java:87) - test() - start
12-04-2019 12:10:19,284 WARN (Slf4jLogger.java:24) - Transaction 10.19.28.18.tm155504938896800002 has timed out and will rollback.
12-04-2019 12:10:28,986 INFO (XXX.java:91) - after sleep
12-04-2019 12:10:29,083 DEBUG (SqlStatementLogger.java:94) -
SELECT
count(1)
FROM
XXX
WHERE
create_date BETWEEN TO_DATE('2018-04-01','YYYY-MM-DD') AND TO_DATE('2019-04-09 23:59:59', 'YYYY-MM-DD HH24:MI:SS')
Why exception is not thrown and execution is not stopped and transaction is not rolled back imemdiately, instead it is stuck like this?
The text was updated successfully, but these errors were encountered:
We have an option to allow rollback on timeout, but disabled by default because some XA drivers have issues with it (since the rollback happens in a different thread than the one that started it).
The transaction is marked for rollback when it times out. The application should cleanup, and commit will fail with rollback as a result.
If you want to avoid pending DB sessions, make sure to set a queryTimeout on your JDBC statements. You could use the same value as the transaction timeout.
I'm building an app using Spring Boot 2.1.3, Atomikos 4.0.6 and Oracle Database 11g. After timeout occurs, transaction doesn't rollback immediately, but instead continues on execution. Can anyone explain if it's the correct behaviour and I don't understand something or am I doing something wrong?
I added
spring-boot-starter-jta-atomikos
to my pom.xml and configured datasource as follows below. I don't explicitly configure anything else related to database like EntityManager or Hibernate properties. Also, I don't configure UserTransactionManager, UserTransactionImp, UserTransactionService and JtaTransactionManager explicitly. Can any of these be a problem?I modify the transaction timeout in properties:
Then I test it using the following method:
Then I see the following in the log and I see the query executing in the database:
Why exception is not thrown and execution is not stopped and transaction is not rolled back imemdiately, instead it is stuck like this?
The text was updated successfully, but these errors were encountered: