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.32k stars 8.78k forks source link

TM shutdown, will not roll back the RM submitted transaction, that is, there is no two-stage rollback operation, and two-stage lock release #1243

Open zwmnhao1980 opened 5 years ago

zwmnhao1980 commented 5 years ago

Ⅰ. Issue Description

TM 关机,不会回滚RM提交的事务,也就是说没有执行二阶段的回滚操作

Ⅱ. Describe what happened

我是在TM最后一步断点,等程序跑到这个断点,我把TM服务关停,RM对应的事务没有执行二阶段回滚操作. 我再启动TM,然后再次请求原来的操作,会发生锁冲突异常(io.seata.rm.datasource.exec.LockConflictException),我想应该上次TM服务关了,没有执行二阶段操作,由于全局事务释放锁是在二阶段执行的。

If there is an exception, please attach the exception trace: org.beetl.sql.core.BeetlSQLException: io.seata.rm.datasource.exec.LockConflictException at org.beetl.sql.core.SQLScript.clean(SQLScript.java:929) at org.beetl.sql.core.SQLScript.clean(SQLScript.java:939) at org.beetl.sql.core.SQLScript.update(SQLScript.java:480) at org.beetl.sql.core.SQLManager.update(SQLManager.java:1460) at org.beetl.sql.core.mapper.UpdateMapperInvoke.call(UpdateMapperInvoke.java:21) at org.beetl.sql.core.mapper.MapperJavaProxy.invoke(MapperJavaProxy.java:210) at org.beetl.sql.core.mapper.MapperJava8Proxy.invoke(MapperJava8Proxy.java:92) at com.sun.proxy.$Proxy68.decreaseStorage(Unknown Source) at io.seata.samples.integration.storage.service.TStorageServiceImpl.decreaseStorage(TStorageServiceImpl.java:29) at io.seata.samples.integration.storage.dubbo.StorageDubboServiceImpl.decreaseStorage(StorageDubboServiceImpl.java:28) at com.alibaba.dubbo.common.bytecode.Wrapper1.invokeMethod(Wrapper1.java) at com.alibaba.dubbo.rpc.proxy.javassist.JavassistProxyFactory$1.doInvoke(JavassistProxyFactory.java:47) at com.alibaba.dubbo.rpc.proxy.AbstractProxyInvoker.invoke(AbstractProxyInvoker.java:76) at com.alibaba.dubbo.config.invoker.DelegateProviderMetaDataInvoker.invoke(DelegateProviderMetaDataInvoker.java:52) at com.alibaba.dubbo.rpc.protocol.InvokerWrapper.invoke(InvokerWrapper.java:56) at io.seata.integration.dubbo.alibaba.TransactionPropagationFilter.invoke(TransactionPropagationFilter.java:61) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72) at com.alibaba.dubbo.rpc.filter.ExceptionFilter.invoke(ExceptionFilter.java:62) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72) at com.alibaba.dubbo.monitor.support.MonitorFilter.invoke(MonitorFilter.java:75) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72) at com.alibaba.dubbo.rpc.filter.TimeoutFilter.invoke(TimeoutFilter.java:42) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72) at com.alibaba.dubbo.rpc.protocol.dubbo.filter.TraceFilter.invoke(TraceFilter.java:78) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72) at com.alibaba.dubbo.rpc.filter.ContextFilter.invoke(ContextFilter.java:73) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72) at com.alibaba.dubbo.rpc.filter.GenericFilter.invoke(GenericFilter.java:138) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72) at com.alibaba.dubbo.rpc.filter.ClassLoaderFilter.invoke(ClassLoaderFilter.java:38) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72) at com.alibaba.dubbo.rpc.filter.EchoFilter.invoke(EchoFilter.java:38) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72) at com.alibaba.dubbo.rpc.protocol.dubbo.DubboProtocol$1.reply(DubboProtocol.java:104) at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.handleRequest(HeaderExchangeHandler.java:96) at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.received(HeaderExchangeHandler.java:173) at com.alibaba.dubbo.remoting.transport.DecodeHandler.received(DecodeHandler.java:51) at com.alibaba.dubbo.remoting.transport.dispatcher.ChannelEventRunnable.run(ChannelEventRunnable.java:57) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: io.seata.rm.datasource.exec.LockConflictException at io.seata.rm.datasource.ConnectionProxy.recognizeLockKeyConflictException(ConnectionProxy.java:128) at io.seata.rm.datasource.ConnectionProxy.processGlobalTransactionCommit(ConnectionProxy.java:179) at io.seata.rm.datasource.ConnectionProxy.commit(ConnectionProxy.java:156) at org.beetl.sql.core.SQLScript.clean(SQLScript.java:923)



### Ⅲ. Describe what you expected to happen
期望在TM服务被关停,应该回滚RM已提交的本地事务,即要二阶段回滚事务。

### Ⅵ. Environment:

- JDK version :1.8
- OS :window7
- Others:springBoot+dubbo+zookeeper
fescar-robot commented 5 years ago

Hi @zwmnhao1980, we detect non-English characters in the issue. This comment is an auto translation from @fescar-robot to help other users to understand this issue. We encourage you to describe your issue in English which is more friendly to other users.

TM shutdown, will not roll back the RM submitted transaction, that is, there is no two-stage rollback operation, and two-stage lock release

Ⅰ. Issue Description

TM shutdown, will not roll back the transaction submitted by RM, that is to say, there is no two-stage rollback operation

Ⅱ. Describe what happened

I am at the last step of the TM breakpoint, wait for the program to run to this breakpoint, I shut down the TM service, the RM corresponding transaction did not perform the two-stage rollback operation. I start the TM again, and then request the original operation again, a lock conflict exception will occur (io.seata.rm.datasource.exec.LockConflictException), I think the last TM service should be closed, no two-stage operation, due to global transactions The release lock is executed in two phases.

If there is an exception, please attach the exception trace: org.beetl.sql.core.BeetlSQLException: io.seata.rm.datasource.exec.LockConflictException at org.beetl.sql.core.SQLScript.clean(SQLScript.java:929) at org.beetl.sql.core.SQLScript.clean(SQLScript.java:939) at org.beetl.sql.core.SQLScript.update(SQLScript.java:480) at org.beetl.sql.core.SQLManager.update(SQLManager.java:1460) at org.beetl.sql.core.mapper.UpdateMapperInvoke.call(UpdateMapperInvoke.java:21) at org.beetl.sql.core.mapper.MapperJavaProxy.invoke(MapperJavaProxy.java:210) at org.beetl.sql.core.mapper.MapperJava8Proxy.invoke(MapperJava8Proxy.java:92) at com.sun.proxy.$Proxy68.decreaseStorage(Unknown Source) at io.seata.samples.integration.storage.service.TStorageServiceImpl.decreaseStorage(TStorageServiceImpl.java:29) at io.seata.samples.integration.storage.dubbo.StorageDubboServiceImpl.decreaseStorage(StorageDubboServiceImpl.java:28) at com.alibaba.dubbo.common.bytecode.Wrapper1.invokeMethod(Wrapper1.java) at com.alibaba.dubbo.rpc.proxy.javassist.JavassistProxyFactory$1.doInvoke(JavassistProxyFactory.java:47) at com.alibaba.dubbo.rpc.proxy.AbstractProxyInvoker.invoke(AbstractProxyInvoker.java:76) at com.alibaba.dubbo.config.invoker.DelegateProviderMetaDataInvoker.invoke(DelegateProviderMetaDataInvoker.java:52) at com.alibaba.dubbo.rpc.protocol.InvokerWrapper.invoke(InvokerWrapper.java:56) at io.seata.integration.dubbo.alibaba.TransactionPropagationFilter.invoke(TransactionPropagationFilter.java:61) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72) at com.alibaba.dubbo.rpc.filter.ExceptionFilter.invoke(ExceptionFilter.java:62) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72) at com.alibaba.dubbo.monitor.support.MonitorFilter.invoke(MonitorFilter.java:75) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72) at com.alibaba.dubbo.rpc.filter.TimeoutFilter.invoke(TimeoutFilter.java:42) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72) at com.alibaba.dubbo.rpc.protocol.dubbo.filter.TraceFilter.invoke(TraceFilter.java:78) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72) at com.alibaba.dubbo.rpc.filter.ContextFilter.invoke(ContextFilter.java:73) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72) at com.alibaba.dubbo.rpc.filter.GenericFilter.invoke(GenericFilter.java:138) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72) at com.alibaba.dubbo.rpc.filter.ClassLoaderFilter.invoke(ClassLoaderFilter.java:38) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72) at com.alibaba.dubbo.rpc.filter.EchoFilter.invoke(EchoFilter.java:38) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72) at com.alibaba.dubbo.rpc.protocol.dubbo.DubboProtocol$1.reply(DubboProtocol.java:104) at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.handleRequest(HeaderExchangeHandler.java:96) at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.received(HeaderExchangeHandler.java:173) at com.alibaba.dubbo.remoting.transport.DecodeHandler.received(DecodeHandler.java:51) at com.alibaba.dubbo.remoting.transport.dispatcher.ChannelEventRunnable.run(ChannelEventRunnable.java:57) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: io.seata.rm.datasource.exec.LockConflictException at io.seata.rm.datasource.ConnectionProxy.recognizeLockKeyConflictException(ConnectionProxy.java:128) at io.seata.rm.datasource.ConnectionProxy.processGlobalTransactionCommit(ConnectionProxy.java:179) at io.seata.rm.datasource.ConnectionProxy.commit(ConnectionProxy.java:156) at org.beetl.sql.core.SQLScript.clean(SQLScript.java:923)



### Ⅲ. Describe what you expected to happen
It is expected that the TM service will be shut down and the RM committed local transaction should be rolled back, that is, the two-stage rollback transaction.

### Ⅵ. Environment:

- JDK version :1.8
- OS :window7
- Others:springBoot+dubbo+zookeeper
slievrly commented 5 years ago

@zwmnhao1980 如何进行TM关停?直接停止应用?你的TM侧的客户端是否也包含了RM?

zwmnhao1980 commented 5 years ago

在TM最后一步断点的地方,人为的把服务关停,TM本身自己没有RM

zwmnhao1980 commented 5 years ago

@slievrly 在TM最后一步断点的地方,人为的把服务关停,TM本身自己没有RM