seata 并发测试报错 -问答-阿里云开发者社区-阿里云

开发者社区> 问答> 正文

seata 并发测试报错

一人吃饱,全家不饿 2021-02-02 11:32:10 183

报错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]

分享到
取消 提交回答
全部回答(1)
  • 一人吃饱,全家不饿
    2021-02-02 11:47:55

    并发操作的数据进行forupdate以保证竞争锁条件生效.

    可以同时修改client.rm.lock.retryInterval client.rm.lock.retryTimes 这俩参数配置,达到竞争锁的周期合理性,以减少该异常的发生

    0 0
+ 订阅

我们开放源码,更相信社区的力量。

推荐文章
相似问题
链接