开发者社区 > 云原生 > 中间件 > 正文

接口使用了seata全局事务,提交几十条数据正常执行,但数据量超过两百条会报异常应该如何排查或处理?

有个接口使用了seata全局事务进行更新数据,提交几十条数据的时候正常执行,但数据量超过两百条的时候就会报异常。应该如何排查或处理?

接口所属项目报错日志: 2023-01-30 16:42:04.757 ERROR 1182262 --- [http-nio-65421-exec-4] aihma.cloud.core.base.ro.ApiRo : org.springframework.orm.jpa.JpaSystemException: Unable to commit against JDBC Connection; nested exception is org.hibernate.TransactionException: Unable to commit against JDBC Connection at org.springframework.orm.jpa.vendor.HibernateJpaDialect.convertHibernateAccessException(HibernateJpaDialect.java:353) at org.springframework.orm.jpa.vendor.HibernateJpaDialect.translateExceptionIfPossible(HibernateJpaDialect.java:255) at org.springframework.orm.jpa.JpaTransactionManager.doCommit(JpaTransactionManager.java:538) at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:743) at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:711) at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:633) at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:386) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:118) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:749) at io.seata.spring.annotation.GlobalTransactionalInterceptor.invoke(GlobalTransactionalInterceptor.java:156) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:749) at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:691) at aihma.cloud.mvc.service.aliIot.impl.SceneServiceImpl$EnhancerBySpringCGLIB$1e408270.editScene() at aihma.cloud.mvc.controller.aliIot.SceneController.edit$original$tn61hLv0(SceneController.java:315) at aihma.cloud.mvc.controller.aliIot.SceneController.edit$original$tn61hLv0$accessor$GjOfNFeB(SceneController.java) at aihma.cloud.mvc.controller.aliIot.SceneController$auxiliary$KFpS4hDy.call(Unknown Source) at org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstMethodsInter.intercept(InstMethodsInter.java:86) at aihma.cloud.mvc.controller.aliIot.SceneController.edit(SceneController.java) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) .....

Caused by: org.hibernate.TransactionException: Unable to commit against JDBC Connection at org.hibernate.resource.jdbc.internal.AbstractLogicalConnectionImplementor.commit(AbstractLogicalConnectionImplementor.java:87) at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl$TransactionDriverControlImpl.commit(JdbcResourceLocalTransactionCoordinatorImpl.java:272) at org.hibernate.engine.transaction.internal.TransactionImpl.commit(TransactionImpl.java:104) at org.springframework.orm.jpa.JpaTransactionManager.doCommit(JpaTransactionManager.java:534) ... 78 more

Caused by: io.seata.rm.datasource.exec.LockConflictException: get global lock fail, xid:172.29.222.218:8091:363364799438757888, lockKeys:iot_scenes_settings:8296716702708613139;iot_scenes_settings:8296716713349562374;过长省略...... at io.seata.rm.datasource.ConnectionProxy.recognizeLockKeyConflictException(ConnectionProxy.java:155) at io.seata.rm.datasource.ConnectionProxy.processGlobalTransactionCommit(ConnectionProxy.java:221) at io.seata.rm.datasource.ConnectionProxy.doCommit(ConnectionProxy.java:199) at io.seata.rm.datasource.ConnectionProxy.lambda$commit$0(ConnectionProxy.java:184) at io.seata.rm.datasource.ConnectionProxy$LockRetryPolicy.execute(ConnectionProxy.java:292) at io.seata.rm.datasource.ConnectionProxy.commit(ConnectionProxy.java:183) at org.hibernate.resource.jdbc.internal.AbstractLogicalConnectionImplementor.commit(AbstractLogicalConnectionImplementor.java:81) ... 81 more

展开
收起
鸡蛋灌饼儿 2023-02-06 11:10:02 344 0
1 条回答
写回答
取消 提交回答
  • 其他事务占用了全局锁还没释放——该回答整理自钉群“3群-Seata 开源讨论群”

    2023-02-06 17:11:28
    赞同 展开评论 打赏

为企业提供高效、稳定、易扩展的中间件产品。

相关电子书

更多
《Seata 1.3 新特性以及如何参与社区》 立即下载
低代码开发师(初级)实战教程 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载