报错1:(10个并发测试的情况下)
io.seata.rm.datasource.exec.LockConflictException: get global lock fail, xid:47.112.208.130:8091:2012755620, lockKeys:t_product:1
at io.seata.rm.datasource.ConnectionProxy.recognizeLockKeyConflictException(ConnectionProxy.java:155) ~[seata-all-1.2.0.jar:1.2.0]
at io.seata.rm.datasource.ConnectionProxy.processGlobalTransactionCommit(ConnectionProxy.java:218) ~[seata-all-1.2.0.jar:1.2.0]
at io.seata.rm.datasource.ConnectionProxy.doCommit(ConnectionProxy.java:196) ~[seata-all-1.2.0.jar:1.2.0]
at io.seata.rm.datasource.ConnectionProxy.lambda$commit$0(ConnectionProxy.java:184) ~[seata-all-1.2.0.jar:1.2.0]
at io.seata.rm.datasource.ConnectionProxy$LockRetryPolicy.execute(ConnectionProxy.java:289) ~[seata-all-1.2.0.jar:1.2.0]
at io.seata.rm.datasource.ConnectionProxy.commit(ConnectionProxy.java:183) ~[seata-all-1.2.0.jar:1.2.0]
at org.springframework.jdbc.datasource.DataSourceTransactionManager.doCommit(DataSourceTransactionManager.java:330) ~[spring-jdbc-5.2.0.RELEASE.jar:5.2.0.RELEASE]
at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:744) ~[spring-tx-5.2.0.RELEASE.jar:5.2.0.RELEASE]
at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:712) ~[spring-tx-5.2.0.RELEASE.jar:5.2.0.RELEASE]
at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:619) ~[spring-tx-5.2.0.RELEASE.jar:5.2.0.RELEASE]
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:372) ~[spring-tx-5.2.0.RELEASE.jar:5.2.0.RELEASE]
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:99) ~[spring-tx-5.2.0.RELEASE.jar:5.2.0.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.2.0.RELEASE.jar:5.2.0.RELEASE]
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:747) ~[spring-aop-5.2.0.RELEASE.jar:5.2.0.RELEASE]
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:689) ~[spring-aop-5.2.0.RELEASE.jar:5.2.0.RELEASE]
at com.sodix.up.service.impl.StorageServiceImpl$$EnhancerBySpringCGLIB$$9d2bf76c.updateById() ~[classes/:na]
报错2:(100个并发测试的情况下)
java.lang.IllegalMonitorStateException: attempt to unlock lock, not locked by current thread by node id: 1d244060-2558-4799-a0d3-61ac029db94f thread-id: 258
at org.redisson.RedissonLock.lambda$unlockAsync$3(RedissonLock.java:581) ~[redisson-3.12.3.jar:3.12.3]
at org.redisson.misc.RedissonPromise.lambda$onComplete$0(RedissonPromise.java:187) ~[redisson-3.12.3.jar:3.12.3]
at io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:577) ~[netty-all-4.1.42.Final.jar:4.1.42.Final]
at io.netty.util.concurrent.DefaultPromise.notifyListeners0(DefaultPromise.java:570) ~[netty-all-4.1.42.Final.jar:4.1.42.Final]
at io.netty.util.concurrent.DefaultPromise.notifyListenersNow(DefaultPromise.java:549) ~[netty-all-4.1.42.Final.jar:4.1.42.Final]
at io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:490) ~[netty-all-4.1.42.Final.jar:4.1.42.Final]
at io.netty.util.concurrent.DefaultPromise.setValue0(DefaultPromise.java:615) ~[netty-all-4.1.42.Final.jar:4.1.42.Final]
at io.netty.util.concurrent.DefaultPromise.setSuccess0(DefaultPromise.java:604) ~[netty-all-4.1.42.Final.jar:4.1.42.Final]
io.seata.core.exception.RmTransactionException: Response[ TransactionException[Could not found global transaction xid = 47.112.208.130:8091:2012755742, may be has finished.] ]
at io.seata.rm.AbstractResourceManager.branchRegister(AbstractResourceManager.java:69) ~[seata-all-1.2.0.jar:1.2.0]
at io.seata.rm.DefaultResourceManager.branchRegister(DefaultResourceManager.java:96) ~[seata-all-1.2.0.jar:1.2.0]
at io.seata.rm.datasource.ConnectionProxy.register(ConnectionProxy.java:238) ~[seata-all-1.2.0.jar:1.2.0]
at io.seata.rm.datasource.ConnectionProxy.processGlobalTransactionCommit(ConnectionProxy.java:216) ~[seata-all-1.2.0.jar:1.2.0]
at io.seata.rm.datasource.ConnectionProxy.doCommit(ConnectionProxy.java:196) ~[seata-all-1.2.0.jar:1.2.0]
at io.seata.rm.datasource.ConnectionProxy.lambda$commit$0(ConnectionProxy.java:184) ~[seata-all-1.2.0.jar:1.2.0]
at io.seata.rm.datasource.ConnectionProxy$LockRetryPolicy.execute(ConnectionProxy.java:289) ~[seata-all-1.2.0.jar:1.2.0]
at io.seata.rm.datasource.ConnectionProxy.commit(ConnectionProxy.java:183) ~[seata-all-1.2.0.jar:1.2.0]
并发操作的数据进行forupdate以保证竞争锁条件生效.
可以同时修改client.rm.lock.retryInterval client.rm.lock.retryTimes 这俩参数配置,达到竞争锁的周期合理性,以减少该异常的发生
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。