You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@seata.apache.org by "Python-IBM (via GitHub)" <gi...@apache.org> on 2024/01/06 08:32:18 UTC
[I] AT mode transaction rollback exception:Before image size is not equaled to after image size [incubator-seata]
Python-IBM opened a new issue, #6244:
URL: https://github.com/apache/incubator-seata/issues/6244
<!-- Please do not use this issue template to report security vulnerabilities but refer to our [security policy](https://github.com/seata/seata/security/policy). -->
- [ ] I have searched the [issues](https://github.com/seata/seata/issues) of this repository and believe that this is not a duplicate.
### Ⅰ. Issue Description
分布式微服务,服务A方法调用服务B方法,出了异常,服务B事务回滚报错
Distributed microservices, Service A method called Service B method, encountered an exception, and Service B transaction rollback reported an error.
### Ⅱ. Describe what happened
If there is an exception, please attach the exception trace:
```
2024-01-06T15:49:29.768+08:00 ERROR 4212 --- [samplesAccount] [:20880-thread-4] o.a.dubbo.rpc.filter.ExceptionFilter : [DUBBO] Got unchecked and undeclared exception which called by 192.168.1.103. service: com.demo.service.account.ITAccountService, method: decreaseAccount, exception: org.springframework.jdbc.UncategorizedSQLException:
### Error updating database. Cause: java.sql.SQLException: io.seata.common.exception.ShouldNeverHappenException: Before image size is not equaled to after image size, probably because you updated the primary keys.
### The error may exist in file [E:\SpringProject\demo-dubbo\samples-account\target\classes\mapper\TAccountMapper.xml]
### The error may involve defaultParameterMap
### The error occurred while setting parameters
### SQL: update t_account set amount = amount-5.0 where user_id = ?
### Cause: java.sql.SQLException: io.seata.common.exception.ShouldNeverHappenException: Before image size is not equaled to after image size, probably because you updated the primary keys.
; uncategorized SQLException; SQL state [null]; error code [0]; io.seata.common.exception.ShouldNeverHappenException: Before image size is not equaled to after image size, probably because you updated the primary keys., dubbo version: 3.2.10, current host: 192.168.1.103, error code: 5-36. This may be caused by , go to https://dubbo.apache.org/faq/5/36 to find instructions.
org.springframework.jdbc.UncategorizedSQLException:
### Error updating database. Cause: java.sql.SQLException: io.seata.common.exception.ShouldNeverHappenException: Before image size is not equaled to after image size, probably because you updated the primary keys.
### The error may exist in file [E:\SpringProject\demo-dubbo\samples-account\target\classes\mapper\TAccountMapper.xml]
### The error may involve defaultParameterMap
### The error occurred while setting parameters
### SQL: update t_account set amount = amount-5.0 where user_id = ?
### Cause: java.sql.SQLException: io.seata.common.exception.ShouldNeverHappenException: Before image size is not equaled to after image size, probably because you updated the primary keys.
; uncategorized SQLException; SQL state [null]; error code [0]; io.seata.common.exception.ShouldNeverHappenException: Before image size is not equaled to after image size, probably because you updated the primary keys.
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:93) ~[mybatis-spring-3.0.3.jar:3.0.3]
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:439) ~[mybatis-spring-3.0.3.jar:3.0.3]
at jdk.proxy2/jdk.proxy2.$Proxy104.update(Unknown Source) ~[na:na]
at org.mybatis.spring.SqlSessionTemplate.update(SqlSessionTemplate.java:288) ~[mybatis-spring-3.0.3.jar:3.0.3]
at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:67) ~[mybatis-3.5.14.jar:3.5.14]
at org.apache.ibatis.binding.MapperProxy$PlainMethodInvoker.invoke(MapperProxy.java:141) ~[mybatis-3.5.14.jar:3.5.14]
at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:86) ~[mybatis-3.5.14.jar:3.5.14]
at jdk.proxy2/jdk.proxy2.$Proxy105.decreaseAccount(Unknown Source) ~[na:na]
at com.demo.account.service.impl.TAccountServiceImpl.decreaseAccount(TAccountServiceImpl.java:36) ~[classes/:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[na:na]
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na]
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:352) ~[spring-aop-6.1.2.jar:6.1.2]
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:713) ~[spring-aop-6.1.2.jar:6.1.2]
at com.demo.account.service.impl.TAccountServiceImpl$$SpringCGLIB$$0.decreaseAccount(<generated>) ~[classes/:na]
at com.demo.service.account.ITAccountServiceDubboWrap1.invokeMethod(ITAccountServiceDubboWrap1.java) ~[classes/:na]
at org.apache.dubbo.rpc.proxy.javassist.JavassistProxyFactory$1.doInvoke(JavassistProxyFactory.java:89) ~[dubbo-3.2.10.jar:3.2.10]
at org.apache.dubbo.rpc.proxy.AbstractProxyInvoker.invoke(AbstractProxyInvoker.java:100) ~[dubbo-3.2.10.jar:3.2.10]
at org.apache.dubbo.config.invoker.DelegateProviderMetaDataInvoker.invoke(DelegateProviderMetaDataInvoker.java:55) ~[dubbo-3.2.10.jar:3.2.10]
at org.apache.dubbo.rpc.protocol.InvokerWrapper.invoke(InvokerWrapper.java:56) ~[dubbo-3.2.10.jar:3.2.10]
at org.apache.dubbo.rpc.filter.ClassLoaderCallbackFilter.invoke(ClassLoaderCallbackFilter.java:38) ~[dubbo-3.2.10.jar:3.2.10]
at org.apache.dubbo.rpc.cluster.filter.FilterChainBuilder$CopyOfFilterChainNode.invoke(FilterChainBuilder.java:349) ~[dubbo-3.2.10.jar:3.2.10]
at com.alibaba.dubbo.rpc.Invoker$CompatibleInvoker.invoke(Invoker.java:77) ~[dubbo-3.2.10.jar:3.2.10]
at io.seata.integration.dubbo.alibaba.AlibabaDubboTransactionPropagationFilter.invoke(AlibabaDubboTransactionPropagationFilter.java:45) ~[seata-all-2.0.0.jar:2.0.0]
at com.alibaba.dubbo.rpc.Filter.invoke(Filter.java:34) ~[dubbo-3.2.10.jar:3.2.10]
at org.apache.dubbo.rpc.cluster.filter.FilterChainBuilder$CopyOfFilterChainNode.invoke(FilterChainBuilder.java:349) ~[dubbo-3.2.10.jar:3.2.10]
at org.apache.dubbo.rpc.protocol.dubbo.filter.TraceFilter.invoke(TraceFilter.java:80) ~[dubbo-3.2.10.jar:3.2.10]
at org.apache.dubbo.rpc.cluster.filter.FilterChainBuilder$CopyOfFilterChainNode.invoke(FilterChainBuilder.java:349) ~[dubbo-3.2.10.jar:3.2.10]
at org.apache.dubbo.rpc.filter.TimeoutFilter.invoke(TimeoutFilter.java:45) ~[dubbo-3.2.10.jar:3.2.10]
at org.apache.dubbo.rpc.cluster.filter.FilterChainBuilder$CopyOfFilterChainNode.invoke(FilterChainBuilder.java:349) ~[dubbo-3.2.10.jar:3.2.10]
at org.apache.dubbo.seata.SeataTransactionPropagationProviderFilter.invoke(SeataTransactionPropagationProviderFilter.java:66) ~[dubbo-filter-seata-1.0.2.jar:1.0.2]
at org.apache.dubbo.rpc.cluster.filter.FilterChainBuilder$CopyOfFilterChainNode.invoke(FilterChainBuilder.java:349) ~[dubbo-3.2.10.jar:3.2.10]
at org.apache.dubbo.monitor.support.MonitorFilter.invoke(MonitorFilter.java:108) ~[dubbo-3.2.10.jar:3.2.10]
at org.apache.dubbo.rpc.cluster.filter.FilterChainBuilder$CopyOfFilterChainNode.invoke(FilterChainBuilder.java:349) ~[dubbo-3.2.10.jar:3.2.10]
at org.apache.dubbo.rpc.filter.ExceptionFilter.invoke(ExceptionFilter.java:54) ~[dubbo-3.2.10.jar:3.2.10]
at org.apache.dubbo.rpc.cluster.filter.FilterChainBuilder$CopyOfFilterChainNode.invoke(FilterChainBuilder.java:349) ~[dubbo-3.2.10.jar:3.2.10]
at org.apache.dubbo.rpc.filter.AccessLogFilter.invoke(AccessLogFilter.java:120) ~[dubbo-3.2.10.jar:3.2.10]
at org.apache.dubbo.rpc.cluster.filter.FilterChainBuilder$CopyOfFilterChainNode.invoke(FilterChainBuilder.java:349) ~[dubbo-3.2.10.jar:3.2.10]
at org.apache.dubbo.metrics.observation.ObservationReceiverFilter.invoke(ObservationReceiverFilter.java:57) ~[dubbo-3.2.10.jar:3.2.10]
at org.apache.dubbo.rpc.cluster.filter.FilterChainBuilder$CopyOfFilterChainNode.invoke(FilterChainBuilder.java:349) ~[dubbo-3.2.10.jar:3.2.10]
at org.apache.dubbo.rpc.filter.GenericFilter.invoke(GenericFilter.java:222) ~[dubbo-3.2.10.jar:3.2.10]
at org.apache.dubbo.rpc.cluster.filter.FilterChainBuilder$CopyOfFilterChainNode.invoke(FilterChainBuilder.java:349) ~[dubbo-3.2.10.jar:3.2.10]
at org.apache.dubbo.rpc.filter.ClassLoaderFilter.invoke(ClassLoaderFilter.java:54) ~[dubbo-3.2.10.jar:3.2.10]
at org.apache.dubbo.rpc.cluster.filter.FilterChainBuilder$CopyOfFilterChainNode.invoke(FilterChainBuilder.java:349) ~[dubbo-3.2.10.jar:3.2.10]
at org.apache.dubbo.rpc.filter.EchoFilter.invoke(EchoFilter.java:41) ~[dubbo-3.2.10.jar:3.2.10]
at org.apache.dubbo.rpc.cluster.filter.FilterChainBuilder$CopyOfFilterChainNode.invoke(FilterChainBuilder.java:349) ~[dubbo-3.2.10.jar:3.2.10]
at org.apache.dubbo.metrics.filter.MetricsFilter.invoke(MetricsFilter.java:86) ~[dubbo-3.2.10.jar:3.2.10]
at org.apache.dubbo.metrics.filter.MetricsProviderFilter.invoke(MetricsProviderFilter.java:37) ~[dubbo-3.2.10.jar:3.2.10]
at org.apache.dubbo.rpc.cluster.filter.FilterChainBuilder$CopyOfFilterChainNode.invoke(FilterChainBuilder.java:349) ~[dubbo-3.2.10.jar:3.2.10]
at org.apache.dubbo.rpc.filter.ProfilerServerFilter.invoke(ProfilerServerFilter.java:66) ~[dubbo-3.2.10.jar:3.2.10]
at org.apache.dubbo.rpc.cluster.filter.FilterChainBuilder$CopyOfFilterChainNode.invoke(FilterChainBuilder.java:349) ~[dubbo-3.2.10.jar:3.2.10]
at org.apache.dubbo.rpc.filter.ContextFilter.invoke(ContextFilter.java:145) ~[dubbo-3.2.10.jar:3.2.10]
at org.apache.dubbo.rpc.cluster.filter.FilterChainBuilder$CopyOfFilterChainNode.invoke(FilterChainBuilder.java:349) ~[dubbo-3.2.10.jar:3.2.10]
at org.apache.dubbo.rpc.cluster.filter.FilterChainBuilder$CallbackRegistrationInvoker.invoke(FilterChainBuilder.java:197) ~[dubbo-3.2.10.jar:3.2.10]
at org.apache.dubbo.rpc.protocol.dubbo.DubboProtocol$1.reply(DubboProtocol.java:167) ~[dubbo-3.2.10.jar:3.2.10]
at org.apache.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.handleRequest(HeaderExchangeHandler.java:110) ~[dubbo-3.2.10.jar:3.2.10]
at org.apache.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.received(HeaderExchangeHandler.java:205) ~[dubbo-3.2.10.jar:3.2.10]
at org.apache.dubbo.remoting.transport.DecodeHandler.received(DecodeHandler.java:52) ~[dubbo-3.2.10.jar:3.2.10]
at org.apache.dubbo.remoting.transport.dispatcher.ChannelEventRunnable.run(ChannelEventRunnable.java:64) ~[dubbo-3.2.10.jar:3.2.10]
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[na:na]
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[na:na]
at org.apache.dubbo.common.threadlocal.InternalRunnable.run(InternalRunnable.java:39) ~[dubbo-3.2.10.jar:3.2.10]
at java.base/java.lang.Thread.run(Thread.java:842) ~[na:na]
Caused by: java.sql.SQLException: io.seata.common.exception.ShouldNeverHappenException: Before image size is not equaled to after image size, probably because you updated the primary keys.
at io.seata.rm.datasource.exec.ExecuteTemplate.execute(ExecuteTemplate.java:172) ~[seata-all-2.0.0.jar:2.0.0]
at io.seata.rm.datasource.exec.ExecuteTemplate.execute(ExecuteTemplate.java:63) ~[seata-all-2.0.0.jar:2.0.0]
at io.seata.rm.datasource.PreparedStatementProxy.execute(PreparedStatementProxy.java:55) ~[seata-all-2.0.0.jar:2.0.0]
at org.apache.ibatis.executor.statement.PreparedStatementHandler.update(PreparedStatementHandler.java:48) ~[mybatis-3.5.14.jar:3.5.14]
at org.apache.ibatis.executor.statement.RoutingStatementHandler.update(RoutingStatementHandler.java:75) ~[mybatis-3.5.14.jar:3.5.14]
at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:50) ~[mybatis-3.5.14.jar:3.5.14]
at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:117) ~[mybatis-3.5.14.jar:3.5.14]
at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:76) ~[mybatis-3.5.14.jar:3.5.14]
at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:197) ~[mybatis-3.5.14.jar:3.5.14]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[na:na]
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na]
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:425) ~[mybatis-spring-3.0.3.jar:3.0.3]
... 62 common frames omitted
Caused by: io.seata.common.exception.ShouldNeverHappenException: Before image size is not equaled to after image size, probably because you updated the primary keys.
at io.seata.rm.datasource.exec.BaseTransactionalExecutor.prepareUndoLog(BaseTransactionalExecutor.java:383) ~[seata-all-2.0.0.jar:2.0.0]
at io.seata.rm.datasource.exec.AbstractDMLBaseExecutor.executeAutoCommitFalse(AbstractDMLBaseExecutor.java:101) ~[seata-all-2.0.0.jar:2.0.0]
at io.seata.rm.datasource.exec.AbstractDMLBaseExecutor.lambda$executeAutoCommitTrue$2(AbstractDMLBaseExecutor.java:145) ~[seata-all-2.0.0.jar:2.0.0]
at io.seata.rm.datasource.ConnectionProxy$LockRetryPolicy.doRetryOnLockConflict(ConnectionProxy.java:356) ~[seata-all-2.0.0.jar:2.0.0]
at io.seata.rm.datasource.exec.AbstractDMLBaseExecutor$LockRetryPolicy.execute(AbstractDMLBaseExecutor.java:188) ~[seata-all-2.0.0.jar:2.0.0]
at io.seata.rm.datasource.exec.AbstractDMLBaseExecutor.executeAutoCommitTrue(AbstractDMLBaseExecutor.java:144) ~[seata-all-2.0.0.jar:2.0.0]
at io.seata.rm.datasource.exec.AbstractDMLBaseExecutor.doExecute(AbstractDMLBaseExecutor.java:83) ~[seata-all-2.0.0.jar:2.0.0]
at io.seata.rm.datasource.exec.BaseTransactionalExecutor.execute(BaseTransactionalExecutor.java:124) ~[seata-all-2.0.0.jar:2.0.0]
at io.seata.rm.datasource.exec.ExecuteTemplate.execute(ExecuteTemplate.java:168) ~[seata-all-2.0.0.jar:2.0.0]
... 75 common frames omitted
```
### Ⅲ. Describe what you expected to happen
我期望成功执行事务,不会报任何异常。
I expect the transaction to be executed successfully without any exceptions.
### Ⅳ. How to reproduce it (as minimally and precisely as possible)
1.
分别启动dubbo服务A和dubbo服务B
Start Dubbo Service A and Dubbo Service B separately.
2.
服务A的方法调用了服务B的方法,这时A方法抛异常让服务B的方法事务回滚
Service A's method called Service B's method, at which point A threw an exception to roll back the transaction of Service B's method.
3.
服务B方法回滚出现异常。
Service B method rollback encountered an exception.
Minimal yet complete reproducer code (or URL to code):

### Ⅴ. Anything else we need to know?
### Ⅵ. Environment:
- JDK version(e.g. `java -version`): 17
- Seata client/server version: 2.0.0
- Database version: MySQL 8.0.27
- OS(e.g. `uname -a`): Windows
- Others: dubbo version: 3.2.10
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@seata.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@seata.apache.org
For additional commands, e-mail: dev-help@seata.apache.org
Re: [I] AT mode transaction rollback exception:Before image size is not equaled to after image size [incubator-seata]
Posted by "Python-IBM (via GitHub)" <gi...@apache.org>.
Python-IBM closed issue #6244: AT mode transaction rollback exception:Before image size is not equaled to after image size
URL: https://github.com/apache/incubator-seata/issues/6244
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org
Re: [I] AT mode transaction rollback exception:Before image size is not equaled to after image size [incubator-seata]
Posted by "slievrly (via GitHub)" <gi...@apache.org>.
slievrly commented on issue #6244:
URL: https://github.com/apache/incubator-seata/issues/6244#issuecomment-1880081070
AT does not support the operation of changing the primary key value.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@seata.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@seata.apache.org
For additional commands, e-mail: dev-help@seata.apache.org
Re: [I] AT mode transaction rollback exception:Before image size is not equaled to after image size [incubator-seata]
Posted by "funky-eyes (via GitHub)" <gi...@apache.org>.
funky-eyes commented on issue #6244:
URL: https://github.com/apache/incubator-seata/issues/6244#issuecomment-1880567460
seata at does not support foreign keys
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org
Re: [I] AT mode transaction rollback exception:Before image size is not equaled to after image size [incubator-seata]
Posted by "Python-IBM (via GitHub)" <gi...@apache.org>.
Python-IBM commented on issue #6244:
URL: https://github.com/apache/incubator-seata/issues/6244#issuecomment-1880251187
> AT does not support the operation of changing the primary key value.
异常日志里的更新sql语句里,“user_id ”不是主键,是外键.
In the update SQL statement in the exception log, "user_id" is not a primary key, but a foreign key
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@seata.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@seata.apache.org
For additional commands, e-mail: dev-help@seata.apache.org