apache / incubator-seata

:fire: Seata is an easy-to-use, high-performance, open source distributed transaction solution.
https://seata.apache.org/
Apache License 2.0
25.35k stars 8.78k forks source link

1.2 版 seata server/client , eureka 注册模式下,执行批量删除操作报错 #2636

Open 604152021 opened 4 years ago

604152021 commented 4 years ago

Ⅰ. Issue Description

eureka 注册模式下,执行批量删除操作报错,大概有两万多条删除。操作不能运行成功,但是事务回滚了。

Ⅱ. Describe what happened

执行批量删除的时候报错了,堆栈信息如下所示

Ⅲ. Describe what you expected to happen

020-04-29 09:20:50.850 INFO [http-nio-8110-exec-2] io.seata.tm.api.DefaultGlobalTransaction - Begin new global transaction [169.254.212.48:8091:2010271861] 2020-04-29 09:20:50.856 DEBUG [http-nio-8110-exec-2] jee.boot.gspl.dao.TtGsplDao.deleteItem - ==> Preparing: delete from tt_gspl_basic_item where gspl_head_id = ? 2020-04-29 09:20:50.867 DEBUG [http-nio-8110-exec-2] jee.boot.gspl.dao.TtGsplDao.deleteItem - ==> Parameters: bb7f55e3967a414a9242b4c5a824ccc6(String) 2020-04-29 09:22:08.788 ERROR [http-nio-8110-exec-2] io.seata.rm.datasource.exec.AbstractDMLBaseExecutor - execute executeAutoCommitTrue error:io.seata.core.exception.RmTransactionException: Response[ TransactionException[Could not found global transaction xid = 169.254.212.48:8091:2010271861, may be has finished.] ] java.sql.SQLException: io.seata.core.exception.RmTransactionException: Response[ TransactionException[Could not found global transaction xid = 169.254.212.48:8091:2010271861, may be has finished.] ] at io.seata.rm.datasource.ConnectionProxy.recognizeLockKeyConflictException(ConnectionProxy.java:157) at io.seata.rm.datasource.ConnectionProxy.processGlobalTransactionCommit(ConnectionProxy.java:218) at io.seata.rm.datasource.ConnectionProxy.doCommit(ConnectionProxy.java:196) at io.seata.rm.datasource.ConnectionProxy.lambda$commit$0(ConnectionProxy.java:184) at io.seata.rm.datasource.ConnectionProxy$$Lambda$659/206784532.call(Unknown Source) at io.seata.rm.datasource.ConnectionProxy$LockRetryPolicy.execute(ConnectionProxy.java:289) at io.seata.rm.datasource.ConnectionProxy.commit(ConnectionProxy.java:183) at io.seata.rm.datasource.exec.AbstractDMLBaseExecutor.lambda$executeAutoCommitTrue$0(AbstractDMLBaseExecutor.java:106) at io.seata.rm.datasource.exec.AbstractDMLBaseExecutor$$Lambda$1157/733925262.call(Unknown Source) at io.seata.rm.datasource.ConnectionProxy$LockRetryPolicy.doRetryOnLockConflict(ConnectionProxy.java:299) at io.seata.rm.datasource.exec.AbstractDMLBaseExecutor$LockRetryPolicy.execute(AbstractDMLBaseExecutor.java:149) at io.seata.rm.datasource.exec.AbstractDMLBaseExecutor.executeAutoCommitTrue(AbstractDMLBaseExecutor.java:104) at io.seata.rm.datasource.exec.AbstractDMLBaseExecutor.doExecute(AbstractDMLBaseExecutor.java:72) at io.seata.rm.datasource.exec.BaseTransactionalExecutor.execute(BaseTransactionalExecutor.java:110) at io.seata.rm.datasource.exec.ExecuteTemplate.execute(ExecuteTemplate.java:108) at io.seata.rm.datasource.exec.ExecuteTemplate.execute(ExecuteTemplate.java:49) at io.seata.rm.datasource.PreparedStatementProxy.execute(PreparedStatementProxy.java:54) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.apache.ibatis.logging.jdbc.PreparedStatementLogger.invoke(PreparedStatementLogger.java:59) at com.sun.proxy.$Proxy326.execute(Unknown Source) at org.apache.ibatis.executor.statement.PreparedStatementHandler.update(PreparedStatementHandler.java:47) at org.apache.ibatis.executor.statement.RoutingStatementHandler.update(RoutingStatementHandler.java:74) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:63) at com.sun.proxy.$Proxy324.update(Unknown Source) at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:50) at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:117) at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:76) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:63) at com.sun.proxy.$Proxy323.update(Unknown Source) at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:198) at org.apache.ibatis.session.defaults.DefaultSqlSession.delete(DefaultSqlSession.java:213) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:433) at com.sun.proxy.$Proxy182.delete(Unknown Source) at org.mybatis.spring.SqlSessionTemplate.delete(SqlSessionTemplate.java:310) at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:69) at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:58) at com.sun.proxy.$Proxy203.deleteItem(Unknown Source)

Ⅳ. How to reproduce it (as minimally and precisely as possible)

Ⅴ. Anything else we need to know?

Ⅵ. Environment:

zjinlei commented 4 years ago

2020-04-29 09:20:50 执行业务sql删除 2020-04-29 09:22:08 1分多后分支事务才注册,默认超时时间1分钟,TC感知超时自动回滚了 如果稳定复现,可能是seata对大量数据删除的性能问题

604152021 commented 4 years ago

@zjinlei 感谢您的回复,Yeah,这个情况每次必出现,可以稳定复现。maybe 是个bug

zjinlei commented 4 years ago

image 试了简单的业务删除,没有复现耗时1分钟+,不过花费7秒也有问题,需要排查下。