alibaba / otter

阿里巴巴分布式数据库同步系统(解决中美异地机房)
Apache License 2.0
8.08k stars 2.49k forks source link

org.springframework.transaction.CannotCreateTransactionException: Could not open JDBC Connection for transaction; nested exception is java.sql.SQLException: Data source is closed #1044

Open dmanbu opened 2 years ago

dmanbu commented 2 years ago

版本: v4.2.18

两个数据库实例间,有多个库的同步任务,其中一个库的同步任务,突然就报出了数据源连不上的情况,请问有人知道怎么回事么? 错误日志:

2022-02-17 03:26:12.599 [DbLoadAction] WARN  com.alibaba.otter.node.etl.load.loader.db.DbLoadAction - ##load phase one failed!
java.util.concurrent.ExecutionException: com.alibaba.otter.node.etl.load.exception.LoadException: org.springframework.transaction.CannotCreateTransactionException: Could not open JDBC Connection for transaction; nested exception is java.sql.SQLException: Data source is closed
        at org.springframework.jdbc.datasource.DataSourceTransactionManager.doBegin(DataSourceTransactionManager.java:240)
        at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:371)
        at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:127)
        at com.alibaba.otter.node.etl.load.loader.db.DbLoadAction$DbLoadWorker.doCall(DbLoadAction.java:617)
        at com.alibaba.otter.node.etl.load.loader.db.DbLoadAction$DbLoadWorker.call(DbLoadAction.java:545)
        at com.alibaba.otter.node.etl.load.loader.db.DbLoadAction$DbLoadWorker.call(DbLoadAction.java:517)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
Caused by: java.sql.SQLException: Data source is closed
        at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1362)
        at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
        at org.springframework.jdbc.datasource.DataSourceTransactionManager.doBegin(DataSourceTransactionManager.java:202)
        ... 9 more
:-----------------
- PairId: 17 , TableId: 14 , EventType : U , Time : 1645038914000
- Consistency :  , Mode :
-----------------
---Pks
        EventColumn[index=0,columnType=4,columnName=id,columnValue=1078076,isNull=false,isKey=true,isUpdate=true]
---oldPks

---Columns
        EventColumn[index=9,columnType=4,columnName=xxx_id,columnValue=330100,isNull=false,isKey=false,isUpdate=true]
---Sql
        update `xxx`.`xxx` set  `xxx_id` = ?  where ( `id` = ? )

        at java.util.concurrent.FutureTask.report(FutureTask.java:122) [na:1.8.0_302]
        at java.util.concurrent.FutureTask.get(FutureTask.java:192) [na:1.8.0_302]
        at com.alibaba.otter.node.etl.load.loader.db.DbLoadAction.doTwoPhase(DbLoadAction.java:410) [node.etl-4.2.18.jar:na]
        at com.alibaba.otter.node.etl.load.loader.db.DbLoadAction.doLoad(DbLoadAction.java:275) [node.etl-4.2.18.jar:na]
        at com.alibaba.otter.node.etl.load.loader.db.DbLoadAction.load(DbLoadAction.java:161) [node.etl-4.2.18.jar:na]
        at com.alibaba.otter.node.etl.load.loader.db.DbLoadAction$$FastClassByCGLIB$$d932a4cb.invoke(<generated>) [cglib-nodep-2.2.jar:na]
        at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:191) [cglib-nodep-2.2.jar:na]
        at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:618) [spring-aop-3.1.2.RELEASE.jar:3.1.2.RELEASE]
        at com.alibaba.otter.node.etl.load.loader.db.DbLoadAction$$EnhancerByCGLIB$$80fd23c2.load(<generated>) [cglib-nodep-2.2.jar:na]
        at com.alibaba.otter.node.etl.load.loader.db.DataBatchLoader$2.call(DataBatchLoader.java:198) [node.etl-4.2.18.jar:na]
        at com.alibaba.otter.node.etl.load.loader.db.DataBatchLoader$2.call(DataBatchLoader.java:189) [node.etl-4.2.18.jar:na]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_302]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_302]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_302]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_302]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_302]
        at java.lang.Thread.run(Thread.java:748) [na:1.8.0_302]
Caused by: com.alibaba.otter.node.etl.load.exception.LoadException: org.springframework.transaction.CannotCreateTransactionException: Could not open JDBC Connection for transaction; nested exception is java.sql.SQLE
xception: Data source is closed
        at org.springframework.jdbc.datasource.DataSourceTransactionManager.doBegin(DataSourceTransactionManager.java:240)
        at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:371)
        at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:127)
        at com.alibaba.otter.node.etl.load.loader.db.DbLoadAction$DbLoadWorker.doCall(DbLoadAction.java:617)
        at com.alibaba.otter.node.etl.load.loader.db.DbLoadAction$DbLoadWorker.call(DbLoadAction.java:545)
        at com.alibaba.otter.node.etl.load.loader.db.DbLoadAction$DbLoadWorker.call(DbLoadAction.java:517)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
Caused by: java.sql.SQLException: Data source is closed
        at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1362)
        at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
        at org.springframework.jdbc.datasource.DataSourceTransactionManager.doBegin(DataSourceTransactionManager.java:202)
        ... 9 more
:-----------------
- PairId: 17 , TableId: 14 , EventType : U , Time : 1645038914000
- Consistency :  , Mode :
-----------------
---Pks
        EventColumn[index=0,columnType=4,columnName=id,columnValue=1078076,isNull=false,isKey=true,isUpdate=true]
---oldPks

---Columns
        EventColumn[index=9,columnType=4,columnName=xxx_id,columnValue=330100,isNull=false,isKey=false,isUpdate=true]
---Sql
        update `xxx`.`xxx` set  `xxx_id` = ?  where ( `id` = ? )
wslyyy commented 7 months ago

怎么解决的