开发者社区> 问答> 正文

seata 报错 LockConflictException

seata 报错 LockConflictException: get global lock fail

springcloud+seata+mybatis+mysql,eureka+db模式,使用注释@GlobalTransactional+@transactional,在跨服务场景下一切正常,但是在单服务场景下的方法上加入两个事务注解运行出现异常(逻辑判断有可能调用其他服务也有可能不调用,问题出现在不调用其他服务的场景下)

org.springframework.transaction.TransactionSystemException: Could not commit JDBC transaction; nested exception is io.seata.rm.datasource.exec.LockConflictException: get global lock fail, xid:192.168.1.48:8091:4008686782, lockKeys:lesson_topic:1250817221014327297;cancel_lesson:1250817473905692673;lesson_topic:1250817473876332545;lesson_class:1250817221026910209;foreign_teacher_booked_record:1250817473972801537;lesson:1250817473859555329;lesson_class:1250817473888915457;lesson:1250817220997550081
	at org.springframework.jdbc.datasource.DataSourceTransactionManager.doCommit(DataSourceTransactionManager.java:332)
	at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:746)
	at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:714)
	at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:534)
	at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:305)
	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:98)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
	at io.seata.spring.annotation.GlobalTransactionalInterceptor$1.execute(GlobalTransactionalInterceptor.java:109)
	at io.seata.tm.api.TransactionalTemplate.execute(TransactionalTemplate.java:64)
	at io.seata.spring.annotation.GlobalTransactionalInterceptor.handleGlobalTransaction(GlobalTransactionalInterceptor.java:106)
Caused by: io.seata.rm.datasource.exec.LockConflictException: get global lock fail, xid:192.168.1.48:8091:4008686782, lockKeys:lesson_topic:1250817221014327297;cancel_lesson:1250817473905692673;lesson_topic:1250817473876332545;lesson_class:1250817221026910209;foreign_teacher_booked_record:1250817473972801537;lesson:1250817473859555329;lesson_class:1250817473888915457;lesson:1250817220997550081
	at io.seata.rm.datasource.ConnectionProxy.recognizeLockKeyConflictException(ConnectionProxy.java:149)
	at io.seata.rm.datasource.ConnectionProxy.processGlobalTransactionCommit(ConnectionProxy.java:213)
	at io.seata.rm.datasource.ConnectionProxy.doCommit(ConnectionProxy.java:190)
	at io.seata.rm.datasource.ConnectionProxy.lambda$commit$0(ConnectionProxy.java:178)
	at io.seata.rm.datasource.ConnectionProxy$LockRetryPolicy.execute(ConnectionProxy.java:283)
	at io.seata.rm.datasource.ConnectionProxy.commit(ConnectionProxy.java:177)
	at org.springframework.jdbc.datasource.DataSourceTransactionManager.doCommit(DataSourceTransactionManager.java:329)
	at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:746)
	at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:714)
	at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:534)

展开
收起
一人吃饱,全家不饿 2021-02-02 11:32:18 9380 0
来自:阿里开源
1 条回答
写回答
取消 提交回答
  • java.sql.BatchUpdateException: Data truncation: Data too long for column 'row_key' at row 1 原因是db模式的key长度为128,key长度超过了128,扩展了字段长度就正常了

    2021-02-02 11:51:26
    赞同 展开评论 打赏
来源圈子
更多
收录在圈子:
+ 订阅
阿里巴巴相信开源的世界里人人贡献代码,人人获得收益,共同创造一个互帮互利的社区,促进技术进步和发展。
问答排行榜
最热
最新

相关电子书

更多
《Seata 1.3 新特性以及如何参与社区》 立即下载
Nacos架构&原理 立即下载
在 Spring 生态中玩转 RocketMQ 立即下载