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.33k stars 8.79k forks source link

io.seata.rm.datasource.exec.LockConflictException #1324

Closed caiyongpan closed 5 years ago

caiyongpan commented 5 years ago

Ⅰ. Issue Description

Ⅱ. Describe what happened

客户端的报错: io.seata.rm.datasource.exec.LockWaitTimeoutException: Global lock wait timeout at io.seata.rm.datasource.exec.LockRetryController.sleep(LockRetryController.java:50) ~[seata-all-0.7.1.jar:0.7.1] at io.seata.rm.datasource.exec.AbstractDMLBaseExecutor.executeAutoCommitTrue(AbstractDMLBaseExecutor.java:98) [seata-all-0.7.1.jar:0.7.1] at io.seata.rm.datasource.exec.AbstractDMLBaseExecutor.doExecute(AbstractDMLBaseExecutor.java:57) [seata-all-0.7.1.jar:0.7.1] at io.seata.rm.datasource.exec.BaseTransactionalExecutor.execute(BaseTransactionalExecutor.java:87) [seata-all-0.7.1.jar:0.7.1] at io.seata.rm.datasource.exec.ExecuteTemplate.execute(ExecuteTemplate.java:101) [seata-all-0.7.1.jar:0.7.1] at io.seata.rm.datasource.exec.ExecuteTemplate.execute(ExecuteTemplate.java:47) [seata-all-0.7.1.jar:0.7.1] at io.seata.rm.datasource.PreparedStatementProxy.execute(PreparedStatementProxy.java:63) [seata-all-0.7.1.jar:0.7.1] at org.apache.shardingsphere.shardingjdbc.jdbc.core.statement.MasterSlavePreparedStatement.execute(MasterSlavePreparedStatement.java:118) [sharding-jdbc-core-4.0.0-RC1.jar:4.0.0-RC1] at org.apache.ibatis.executor.statement.PreparedStatementHandler.update(PreparedStatementHandler.java:46) [mybatis-3.4.5.jar:3.4.5] at org.apache.ibatis.executor.statement.RoutingStatementHandler.update(RoutingStatementHandler.java:74) [mybatis-3.4.5.jar:3.4.5] at org.apache.ibatis.executor.ReuseExecutor.doUpdate(ReuseExecutor.java:52) [mybatis-3.4.5.jar:3.4.5] at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:117) [mybatis-3.4.5.jar:3.4.5] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_201] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_201] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_201] at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_201] at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:63) [mybatis-3.4.5.jar:3.4.5] at com.sun.proxy.$Proxy83.update(Unknown Source) [na:na] at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:198) [mybatis-3.4.5.jar:3.4.5] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_201] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_201] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_201] at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_201] at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:433) [mybatis-spring-1.3.1.jar:1.3.1] at com.sun.proxy.$Proxy70.update(Unknown Source) [na:na] at org.mybatis.spring.SqlSessionTemplate.update(SqlSessionTemplate.java:294) [mybatis-spring-1.3.1.jar:1.3.1] at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:62) [mybatis-3.4.5.jar:3.4.5] at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:59) [mybatis-3.4.5.jar:3.4.5] at com.sun.proxy.$Proxy71.decreaseAccount(Unknown Source) [na:na] at com.soonchina.service.impl.ITAccountServiceImpl.decreaseAccount(ITAccountServiceImpl.java:23) [classes/:na] at com.soonchina.impl.AccountDubboServiceImpl.decreaseAccount(AccountDubboServiceImpl.java:31) [classes/:na] at org.apache.dubbo.common.bytecode.Wrapper1.invokeMethod(Wrapper1.java) [dubbo-2.7.2.jar:2.7.2] at org.apache.dubbo.rpc.proxy.javassist.JavassistProxyFactory$1.doInvoke(JavassistProxyFactory.java:47) [dubbo-2.7.2.jar:2.7.2] at org.apache.dubbo.rpc.proxy.AbstractProxyInvoker.invoke(AbstractProxyInvoker.java:84) [dubbo-2.7.2.jar:2.7.2] at org.apache.dubbo.config.invoker.DelegateProviderMetaDataInvoker.invoke(DelegateProviderMetaDataInvoker.java:56) [dubbo-2.7.2.jar:2.7.2] at org.apache.dubbo.rpc.protocol.InvokerWrapper.invoke(InvokerWrapper.java:56) [dubbo-2.7.2.jar:2.7.2] at io.seata.integration.dubbo.TransactionPropagationFilter.invoke(TransactionPropagationFilter.java:60) [seata-all-0.7.1.jar:0.7.1] at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:82) [dubbo-2.7.2.jar:2.7.2] at org.apache.dubbo.rpc.filter.ExceptionFilter.invoke(ExceptionFilter.java:55) [dubbo-2.7.2.jar:2.7.2] at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:82) [dubbo-2.7.2.jar:2.7.2] at org.apache.dubbo.monitor.support.MonitorFilter.invoke(MonitorFilter.java:92) [dubbo-2.7.2.jar:2.7.2] at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:82) [dubbo-2.7.2.jar:2.7.2] at org.apache.dubbo.rpc.filter.TimeoutFilter.invoke(TimeoutFilter.java:48) [dubbo-2.7.2.jar:2.7.2] at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:82) [dubbo-2.7.2.jar:2.7.2] at org.apache.dubbo.rpc.protocol.dubbo.filter.TraceFilter.invoke(TraceFilter.java:81) [dubbo-2.7.2.jar:2.7.2] at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:82) [dubbo-2.7.2.jar:2.7.2] at org.apache.dubbo.rpc.filter.ContextFilter.invoke(ContextFilter.java:96) [dubbo-2.7.2.jar:2.7.2] at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:82) [dubbo-2.7.2.jar:2.7.2] at org.apache.dubbo.rpc.filter.GenericFilter.invoke(GenericFilter.java:148) [dubbo-2.7.2.jar:2.7.2] at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:82) [dubbo-2.7.2.jar:2.7.2] at org.apache.dubbo.rpc.filter.ClassLoaderFilter.invoke(ClassLoaderFilter.java:38) [dubbo-2.7.2.jar:2.7.2] at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:82) [dubbo-2.7.2.jar:2.7.2] at org.apache.dubbo.rpc.filter.EchoFilter.invoke(EchoFilter.java:41) [dubbo-2.7.2.jar:2.7.2] at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:82) [dubbo-2.7.2.jar:2.7.2] at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$CallbackRegistrationInvoker.invoke(ProtocolFilterWrapper.java:150) [dubbo-2.7.2.jar:2.7.2] at org.apache.dubbo.rpc.protocol.dubbo.DubboProtocol$1.reply(DubboProtocol.java:152) [dubbo-2.7.2.jar:2.7.2] at org.apache.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.handleRequest(HeaderExchangeHandler.java:102) [dubbo-2.7.2.jar:2.7.2] at org.apache.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.received(HeaderExchangeHandler.java:193) [dubbo-2.7.2.jar:2.7.2] at org.apache.dubbo.remoting.transport.DecodeHandler.received(DecodeHandler.java:51) [dubbo-2.7.2.jar:2.7.2] at org.apache.dubbo.remoting.transport.dispatcher.ChannelEventRunnable.run(ChannelEventRunnable.java:57) [dubbo-2.7.2.jar:2.7.2] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_201] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_201] at java.lang.Thread.run(Thread.java:748) [na:1.8.0_201] Caused by: io.seata.rm.datasource.exec.LockConflictException: null at io.seata.rm.datasource.ConnectionProxy.recognizeLockKeyConflictException(ConnectionProxy.java:128) ~[seata-all-0.7.1.jar:0.7.1] at io.seata.rm.datasource.ConnectionProxy.processGlobalTransactionCommit(ConnectionProxy.java:179) ~[seata-all-0.7.1.jar:0.7.1] at io.seata.rm.datasource.ConnectionProxy.commit(ConnectionProxy.java:156) ~[seata-all-0.7.1.jar:0.7.1] at io.seata.rm.datasource.exec.AbstractDMLBaseExecutor.executeAutoCommitTrue(AbstractDMLBaseExecutor.java:94) [seata-all-0.7.1.jar:0.7.1] ... 61 common frames omitted

org.springframework.jdbc.UncategorizedSQLException:

Error updating database. Cause: io.seata.rm.datasource.exec.LockConflictException

The error may involve defaultParameterMap

The error occurred while setting parameters

SQL: update account_tbl set money=money-? where user_id=?

Cause: io.seata.rm.datasource.exec.LockConflictException

; uncategorized SQLException; SQL state [null]; error code [0]; null; nested exception is io.seata.rm.datasource.exec.LockConflictException at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:89) at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81) at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81) at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:73) at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:446) at com.sun.proxy.$Proxy70.update(Unknown Source) at org.mybatis.spring.SqlSessionTemplate.update(SqlSessionTemplate.java:294) at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:62) at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:59) at com.sun.proxy.$Proxy71.decreaseAccount(Unknown Source) at com.soonchina.service.impl.ITAccountServiceImpl.decreaseAccount(ITAccountServiceImpl.java:23) at com.soonchina.impl.AccountDubboServiceImpl.decreaseAccount(AccountDubboServiceImpl.java:31) at org.apache.dubbo.common.bytecode.Wrapper1.invokeMethod(Wrapper1.java) at org.apache.dubbo.rpc.proxy.javassist.JavassistProxyFactory$1.doInvoke(JavassistProxyFactory.java:47) at org.apache.dubbo.rpc.proxy.AbstractProxyInvoker.invoke(AbstractProxyInvoker.java:84) at org.apache.dubbo.config.invoker.DelegateProviderMetaDataInvoker.invoke(DelegateProviderMetaDataInvoker.java:56) at org.apache.dubbo.rpc.protocol.InvokerWrapper.invoke(InvokerWrapper.java:56) at io.seata.integration.dubbo.TransactionPropagationFilter.invoke(TransactionPropagationFilter.java:60) at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:82) at org.apache.dubbo.rpc.filter.ExceptionFilter.invoke(ExceptionFilter.java:55) at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:82) at org.apache.dubbo.monitor.support.MonitorFilter.invoke(MonitorFilter.java:92) at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:82) at org.apache.dubbo.rpc.filter.TimeoutFilter.invoke(TimeoutFilter.java:48) at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:82) at org.apache.dubbo.rpc.protocol.dubbo.filter.TraceFilter.invoke(TraceFilter.java:81) at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:82) at org.apache.dubbo.rpc.filter.ContextFilter.invoke(ContextFilter.java:96) at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:82) at org.apache.dubbo.rpc.filter.GenericFilter.invoke(GenericFilter.java:148) at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:82) at org.apache.dubbo.rpc.filter.ClassLoaderFilter.invoke(ClassLoaderFilter.java:38) at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:82) at org.apache.dubbo.rpc.filter.EchoFilter.invoke(EchoFilter.java:41) at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:82) at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$CallbackRegistrationInvoker.invoke(ProtocolFilterWrapper.java:150) at org.apache.dubbo.rpc.protocol.dubbo.DubboProtocol$1.reply(DubboProtocol.java:152) at org.apache.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.handleRequest(HeaderExchangeHandler.java:102) at org.apache.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.received(HeaderExchangeHandler.java:193) at org.apache.dubbo.remoting.transport.DecodeHandler.received(DecodeHandler.java:51) at org.apache.dubbo.remoting.transport.dispatcher.ChannelEventRunnable.run(ChannelEventRunnable.java:57) 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: 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 io.seata.rm.datasource.ConnectionProxy.setAutoCommit(ConnectionProxy.java:218) at io.seata.rm.datasource.exec.AbstractDMLBaseExecutor.executeAutoCommitTrue(AbstractDMLBaseExecutor.java:107) at io.seata.rm.datasource.exec.AbstractDMLBaseExecutor.doExecute(AbstractDMLBaseExecutor.java:57) at io.seata.rm.datasource.exec.BaseTransactionalExecutor.execute(BaseTransactionalExecutor.java:87) at io.seata.rm.datasource.exec.ExecuteTemplate.execute(ExecuteTemplate.java:101) at io.seata.rm.datasource.exec.ExecuteTemplate.execute(ExecuteTemplate.java:47) at io.seata.rm.datasource.PreparedStatementProxy.execute(PreparedStatementProxy.java:63) at org.apache.shardingsphere.shardingjdbc.jdbc.core.statement.MasterSlavePreparedStatement.execute(MasterSlavePreparedStatement.java:118) at org.apache.ibatis.executor.statement.PreparedStatementHandler.update(PreparedStatementHandler.java:46) at org.apache.ibatis.executor.statement.RoutingStatementHandler.update(RoutingStatementHandler.java:74) at org.apache.ibatis.executor.ReuseExecutor.doUpdate(ReuseExecutor.java:52) at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:117) 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:498) at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:63) at com.sun.proxy.$Proxy83.update(Unknown Source) at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:198) 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:498) at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:433) ... 39 more seta-server 端的报错: io.seata.core.exception.TransactionException: null at io.seata.server.coordinator.DefaultCore.lambda$branchRegister$0(DefaultCore.java:79) at io.seata.server.session.GlobalSession.lockAndExcute(GlobalSession.java:594) at io.seata.server.coordinator.DefaultCore.branchRegister(DefaultCore.java:66) at io.seata.server.coordinator.DefaultCoordinator.doBranchRegister(DefaultCoordinator.java:174) at io.seata.server.AbstractTCInboundHandler$4.execute(AbstractTCInboundHandler.java:148) at io.seata.server.AbstractTCInboundHandler$4.execute(AbstractTCInboundHandler.java:144) at io.seata.core.exception.AbstractExceptionHandler.exceptionHandleTemplate(AbstractExceptionHandler.java:117) at io.seata.server.AbstractTCInboundHandler.handle(AbstractTCInboundHandler.java:144) at io.seata.core.protocol.transaction.BranchRegisterRequest.handle(BranchRegisterRequest.java:136) at io.seata.server.coordinator.DefaultCoordinator.onRequest(DefaultCoordinator.java:430) at io.seata.core.rpc.DefaultServerMessageListenerImpl.onTrxMessage(DefaultServerMessageListenerImpl.java:87) at io.seata.core.rpc.netty.RpcServer.dispatch(RpcServer.java:252) at io.seata.core.rpc.netty.AbstractRpcRemoting$3.run(AbstractRpcRemoting.java:371) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) at java.lang.Thread.run(Thread.java:748)

Ⅲ. Describe what you expected to happen

当对seata-server 进行集群的时候 会出现这样的问题,单机的seata-server是没问题的

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

Ⅴ. Anything else we need to know?

Ⅵ. Environment:

fescar-robot commented 5 years ago

Hi @caiyongpan, 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.

io.seata.rm.datasource.exec.LockConflictException

Ⅰ. Issue Description

Ⅱ. Describe what happened

The client's error: io.seata.rm.datasource.exec.LockWaitTimeoutException: Global lock wait timeout at io.seata.rm.datasource.exec.LockRetryController.sleep(LockRetryController.java:50) ~[seata-all-0.7.1.jar:0.7.1] at io.seata.rm.datasource.exec.AbstractDMLBaseExecutor.executeAutoCommitTrue(AbstractDMLBaseExecutor.java:98) [seata-all-0.7.1.jar:0.7.1] at io.seata.rm.datasource.exec.AbstractDMLBaseExecutor.doExecute(AbstractDMLBaseExecutor.java:57) [seata-all-0.7.1.jar:0.7.1] at io.seata.rm.datasource.exec.BaseTransactionalExecutor.execute(BaseTransactionalExecutor.java:87) [seata-all-0.7.1.jar:0.7.1] at io.seata.rm.datasource.exec.ExecuteTemplate.execute(ExecuteTemplate.java:101) [seata-all-0.7.1.jar:0.7.1] at io.seata.rm.datasource.exec.ExecuteTemplate.execute(ExecuteTemplate.java:47) [seata-all-0.7.1.jar:0.7.1] at io.seata.rm.datasource.PreparedStatementProxy.execute(PreparedStatementProxy.java:63) [seata-all-0.7.1.jar:0.7.1] at org.apache.shardingsphere.shardingjdbc.jdbc.core.statement.MasterSlavePreparedStatement.execute(MasterSlavePreparedStatement.java:118) [sharding-jdbc-core-4.0.0-RC1.jar:4.0.0-RC1] at org.apache.ibatis.executor.statement.PreparedStatementHandler.update(PreparedStatementHandler.java:46) [mybatis-3.4.5.jar:3.4.5] at org.apache.ibatis.executor.statement.RoutingStatementHandler.update(RoutingStatementHandler.java:74) [mybatis-3.4.5.jar:3.4.5] at org.apache.ibatis.executor.ReuseExecutor.doUpdate(ReuseExecutor.java:52) [mybatis-3.4.5.jar:3.4.5] at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:117) [mybatis-3.4.5.jar:3.4.5] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_201] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_201] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_201] at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_201] at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:63) [mybatis-3.4.5.jar:3.4.5] at com.sun.proxy.$Proxy83.update(Unknown Source) [na:na] at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:198) [mybatis-3.4.5.jar:3.4.5] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_201] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_201] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_201] at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_201] at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:433) [mybatis-spring-1.3.1.jar:1.3.1] at com.sun.proxy.$Proxy70.update(Unknown Source) [na:na] at org.mybatis.spring.SqlSessionTemplate.update(SqlSessionTemplate.java:294) [mybatis-spring-1.3.1.jar:1.3.1] at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:62) [mybatis-3.4.5.jar:3.4.5] at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:59) [mybatis-3.4.5.jar:3.4.5] at com.sun.proxy.$Proxy71.decreaseAccount(Unknown Source) [na:na] at com.soonchina.service.impl.ITAccountServiceImpl.decreaseAccount(ITAccountServiceImpl.java:23) [classes/:na] at com.soonchina.impl.AccountDubboServiceImpl.decreaseAccount(AccountDubboServiceImpl.java:31) [classes/:na] at org.apache.dubbo.common.bytecode.Wrapper1.invokeMethod(Wrapper1.java) [dubbo-2.7.2.jar:2.7.2] at org.apache.dubbo.rpc.proxy.javassist.JavassistProxyFactory$1.doInvoke(JavassistProxyFactory.java:47) [dubbo-2.7.2.jar:2.7.2] at org.apache.dubbo.rpc.proxy.AbstractProxyInvoker.invoke(AbstractProxyInvoker.java:84) [dubbo-2.7.2.jar:2.7.2] at org.apache.dubbo.config.invoker.DelegateProviderMetaDataInvoker.invoke(DelegateProviderMetaDataInvoker.java:56) [dubbo-2.7.2.jar:2.7.2] at org.apache.dubbo.rpc.protocol.InvokerWrapper.invoke(InvokerWrapper.java:56) [dubbo-2.7.2.jar:2.7.2] at io.seata.integration.dubbo.TransactionPropagationFilter.invoke(TransactionPropagationFilter.java:60) [seata-all-0.7.1.jar:0.7.1] at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:82) [dubbo-2.7.2.jar:2.7.2] at org.apache.dubbo.rpc.filter.ExceptionFilter.invoke(ExceptionFilter.java:55) [dubbo-2.7.2.jar:2.7.2] at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:82) [dubbo-2.7.2.jar:2.7.2] at org.apache.dubbo.monitor.support.MonitorFilter.invoke(MonitorFilter.java:92) [dubbo-2.7.2.jar:2.7.2] at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:82) [dubbo-2.7.2.jar:2.7.2] at org.apache.dubbo.rpc.filter.TimeoutFilter.invoke(TimeoutFilter.java:48) [dubbo-2.7.2.jar:2.7.2] at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:82) [dubbo-2.7.2.jar:2.7.2] at org.apache.dubbo.rpc.protocol.dubbo.filter.TraceFilter.invoke(TraceFilter.java:81) [dubbo-2.7.2.jar:2.7.2] at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:82) [dubbo-2.7.2.jar:2.7.2] at org.apache.dubbo.rpc.filter.ContextFilter.invoke(ContextFilter.java:96) [dubbo-2.7.2.jar:2.7.2] at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:82) [dubbo-2.7.2.jar:2.7.2] at org.apache.dubbo.rpc.filter.GenericFilter.invoke(GenericFilter.java:148) [dubbo-2.7.2.jar:2.7.2] at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:82) [dubbo-2.7.2.jar:2.7.2] at org.apache.dubbo.rpc.filter.ClassLoaderFilter.invoke(ClassLoaderFilter.java:38) [dubbo-2.7.2.jar:2.7.2] at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:82) [dubbo-2.7.2.jar:2.7.2] at org.apache.dubbo.rpc.filter.EchoFilter.invoke(EchoFilter.java:41) [dubbo-2.7.2.jar:2.7.2] at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:82) [dubbo-2.7.2.jar:2.7.2] at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$CallbackRegistrationInvoker.invoke(ProtocolFilterWrapper.java:150) [dubbo-2.7.2.jar:2.7.2] at org.apache.dubbo.rpc.protocol.dubbo.DubboProtocol$1.reply(DubboProtocol.java:152) [dubbo-2.7.2.jar:2.7.2] at org.apache.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.handleRequest(HeaderExchangeHandler.java:102) [dubbo-2.7.2.jar:2.7.2] at org.apache.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.received(HeaderExchangeHandler.java:193) [dubbo-2.7.2.jar:2.7.2] at org.apache.dubbo.remoting.transport.DecodeHandler.received(DecodeHandler.java:51) [dubbo-2.7.2.jar:2.7.2] at org.apache.dubbo.remoting.transport.dispatcher.ChannelEventRunnable.run(ChannelEventRunnable.java:57) [dubbo-2.7.2.jar:2.7.2] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_201] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_201] at java.lang.Thread.run(Thread.java:748) [na:1.8.0_201] Caused by: io.seata.rm.datasource.exec.LockConflictException: null at io.seata.rm.datasource.ConnectionProxy.recognizeLockKeyConflictException(ConnectionProxy.java:128) ~[seata-all-0.7.1.jar:0.7.1] at io.seata.rm.datasource.ConnectionProxy.processGlobalTransactionCommit(ConnectionProxy.java:179) ~[seata-all-0.7.1.jar:0.7.1] at io.seata.rm.datasource.ConnectionProxy.commit(ConnectionProxy.java:156) ~[seata-all-0.7.1.jar:0.7.1] at io.seata.rm.datasource.exec.AbstractDMLBaseExecutor.executeAutoCommitTrue(AbstractDMLBaseExecutor.java:94) [seata-all-0.7.1.jar:0.7.1] ... 61 common frames omitted

org.springframework.jdbc.UncategorizedSQLException:

Error updating database. Cause: io.seata.rm.datasource.exec.LockConflictException

The error may involve defaultParameterMap

The error occurred while setting parameters

SQL: update account_tbl set money=money-? where user_id=?

Cause: io.seata.rm.datasource.exec.LockConflictException

; uncategorized SQLException; SQL state [null]; error code [0]; null; nested exception is io.seata.rm.datasource.exec.LockConflictException at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:89) at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81) at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81) at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:73) at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:446) at com.sun.proxy.$Proxy70.update(Unknown Source) at org.mybatis.spring.SqlSessionTemplate.update(SqlSessionTemplate.java:294) at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:62) at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:59) at com.sun.proxy.$Proxy71.decreaseAccount(Unknown Source) at com.soonchina.service.impl.ITAccountServiceImpl.decreaseAccount(ITAccountServiceImpl.java:23) at com.soonchina.impl.AccountDubboServiceImpl.decreaseAccount(AccountDubboServiceImpl.java:31) at org.apache.dubbo.common.bytecode.Wrapper1.invokeMethod(Wrapper1.java) at org.apache.dubbo.rpc.proxy.javassist.JavassistProxyFactory$1.doInvoke(JavassistProxyFactory.java:47) at org.apache.dubbo.rpc.proxy.AbstractProxyInvoker.invoke(AbstractProxyInvoker.java:84) at org.apache.dubbo.config.invoker.DelegateProviderMetaDataInvoker.invoke(DelegateProviderMetaDataInvoker.java:56) at org.apache.dubbo.rpc.protocol.InvokerWrapper.invoke(InvokerWrapper.java:56) at io.seata.integration.dubbo.TransactionPropagationFilter.invoke(TransactionPropagationFilter.java:60) at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:82) at org.apache.dubbo.rpc.filter.ExceptionFilter.invoke(ExceptionFilter.java:55) at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:82) at org.apache.dubbo.monitor.support.MonitorFilter.invoke(MonitorFilter.java:92) at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:82) at org.apache.dubbo.rpc.filter.TimeoutFilter.invoke(TimeoutFilter.java:48) at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:82) at org.apache.dubbo.rpc.protocol.dubbo.filter.TraceFilter.invoke(TraceFilter.java:81) at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:82) at org.apache.dubbo.rpc.filter.ContextFilter.invoke(ContextFilter.java:96) at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:82) at org.apache.dubbo.rpc.filter.GenericFilter.invoke(GenericFilter.java:148) at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:82) at org.apache.dubbo.rpc.filter.ClassLoaderFilter.invoke(ClassLoaderFilter.java:38) at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:82) at org.apache.dubbo.rpc.filter.EchoFilter.invoke(EchoFilter.java:41) at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:82) at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$CallbackRegistrationInvoker.invoke(ProtocolFilterWrapper.java:150) at org.apache.dubbo.rpc.protocol.dubbo.DubboProtocol$1.reply(DubboProtocol.java:152) at org.apache.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.handleRequest(HeaderExchangeHandler.java:102) at org.apache.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.received(HeaderExchangeHandler.java:193) at org.apache.dubbo.remoting.transport.DecodeHandler.received(DecodeHandler.java:51) at org.apache.dubbo.remoting.transport.dispatcher.ChannelEventRunnable.run(ChannelEventRunnable.java:57) 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: 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 io.seata.rm.datasource.ConnectionProxy.setAutoCommit(ConnectionProxy.java:218) at io.seata.rm.datasource.exec.AbstractDMLBaseExecutor.executeAutoCommitTrue(AbstractDMLBaseExecutor.java:107) at io.seata.rm.datasource.exec.AbstractDMLBaseExecutor.doExecute(AbstractDMLBaseExecutor.java:57) at io.seata.rm.datasource.exec.BaseTransactionalExecutor.execute(BaseTransactionalExecutor.java:87) at io.seata.rm.datasource.exec.ExecuteTemplate.execute(ExecuteTemplate.java:101) at io.seata.rm.datasource.exec.ExecuteTemplate.execute(ExecuteTemplate.java:47) at io.seata.rm.datasource.PreparedStatementProxy.execute(PreparedStatementProxy.java:63) at org.apache.shardingsphere.shardingjdbc.jdbc.core.statement.MasterSlavePreparedStatement.execute(MasterSlavePreparedStatement.java:118) at org.apache.ibatis.executor.statement.PreparedStatementHandler.update(PreparedStatementHandler.java:46) at org.apache.ibatis.executor.statement.RoutingStatementHandler.update(RoutingStatementHandler.java:74) at org.apache.ibatis.executor.ReuseExecutor.doUpdate(ReuseExecutor.java:52) at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:117) 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:498) at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:63) at com.sun.proxy.$Proxy83.update(Unknown Source) at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:198) 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:498) at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:433) ... 39 more Error on the seta-server side: io.seata.core.exception.TransactionException: null at io.seata.server.coordinator.DefaultCore.lambda$branchRegister$0(DefaultCore.java:79) at io.seata.server.session.GlobalSession.lockAndExcute(GlobalSession.java:594) at io.seata.server.coordinator.DefaultCore.branchRegister(DefaultCore.java:66) at io.seata.server.coordinator.DefaultCoordinator.doBranchRegister(DefaultCoordinator.java:174) at io.seata.server.AbstractTCInboundHandler$4.execute(AbstractTCInboundHandler.java:148) at io.seata.server.AbstractTCInboundHandler$4.execute(AbstractTCInboundHandler.java:144) at io.seata.core.exception.AbstractExceptionHandler.exceptionHandleTemplate(AbstractExceptionHandler.java:117) at io.seata.server.AbstractTCInboundHandler.handle(AbstractTCInboundHandler.java:144) at io.seata.core.protocol.transaction.BranchRegisterRequest.handle(BranchRegisterRequest.java:136) at io.seata.server.coordinator.DefaultCoordinator.onRequest(DefaultCoordinator.java:430) at io.seata.core.rpc.DefaultServerMessageListenerImpl.onTrxMessage(DefaultServerMessageListenerImpl.java:87) at io.seata.core.rpc.netty.RpcServer.dispatch(RpcServer.java:252) at io.seata.core.rpc.netty.AbstractRpcRemoting$3.run(AbstractRpcRemoting.java:371) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) at java.lang.Thread.run(Thread.java:748)

Ⅲ. Describe what you expected to happen

This problem occurs when clustering seaa-server. The stand-alone seta-server is okay.

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

Ⅴ. Anything else we need to know?

Ⅵ. Environment:

lomo-dcm commented 5 years ago

我也遇到这问题了。 怎么解决的?

renliangyu857 commented 3 years ago

同遇到,解决了吗

caiyongpan commented 3 years ago

同遇到,解决了吗

解决了

yangnima commented 3 years ago

同遇到,解决了吗

解决了

怎么解决的啊?