-
Notifications
You must be signed in to change notification settings - Fork 8.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Could not register branch into global session status = TimeoutRollbacking while expecting Begin #6930
Comments
基本上就是时区问题,不要这么肯定的回答,你还没调用就回滚了,能不是时区导致的? |
看看server日志,再看看实际的时区,而不是仅靠 |
我检查了seata-server、数据库mariadb、业务容器内的时区,是Asia/Shanghai,下面截图里时间不一致是因为执行命令的时间不同。 seata-server 容器内: 数据库maridab容器内: 业务容器: 报错的时候,seata-server的日志: 业务的日志是: java.sql.SQLException: io.seata.core.exception.RmTransactionException: Response[ TransactionException[Could not register branch into global session xid = 192.168.130.21:8091:18590791467254237 status = TimeoutRollbacking while expecting Begin] ] |
看server日志是不是输出过timeoutrollbacking类似的日志信息,如果有就是时区导致查出来对不上,可以考虑在jdbcurl上知道时区等方式试试能否解决 |
另一个简单验证的方法,起一个seata-server 用file模式.对这个server进行压测,如果再也没出现这个问题,换成db模式就会出现这个问题,说明一定是时区问题 |
你好,我将store.mode改成file后试验了,没有出现错误。然后将store.mode改为db试验后,还是会出现错误。我又检查了数据库里时区,执行show variables like '%time_zone%'; 输出: store.db.url中配置的serverTimezone本来是UTC,我以为是这个导致的,将UTC改成了Asia/Shanghai尝试了下,还是会出错误。 另外还有个疑问,我在nacos上修改配置项是client.tm.defaultGlobalTransactionTimeout,为什么我几次修改这个配置项后,删掉seata容器再重新创建,打印的日志中SeataMergeMessage timeout=240000,timeout一直是240000,并不是我修改后的client.tm.defaultGlobalTransactionTimeout。而其他配置项,例如store.mode、store.db.url、store.db.password修改后,再重新创建seata容器能生效。 现在我的疑问就是问题大概率是时区问题导致的,但暂时找不到到底哪里的时区不一致。linux服务器是CST、业务pod是Asia/Shanghai、seata容器是Asia/Shanghai、mysql容器Asia/Shanghai、业务pod里jdbc连接串serverTimezone=GMT+8、seata中store.db.url:jdbc连接串serverTimezone=Asia/Shanghai ps:跟我所有的容器都部署在虚拟机里有关系吗?隔壁部门在物理机上部署了一套相同的服务,没有遇到问题。 下面是出错时候seata控制台打印的日志: |
The issue here has been confirmed, is that the default timeout configuration does not take effect. |
你的client是如何配置nacos为配置中心的?client.tm.defaultGlobalTransactionTimeout 是属于client的配置,而不是server的配置? |
可以尝试给将server启动命令增加 -Duser.timezone=Asia/Shanghai 参数 |
是的,是我弄错了,修改后,没有重启业务pod。 |
我采用了docker部署,部署的时候添加了将-Duser.timezone=Asia/Shanghai 添加到JAVA_OPTS,试验了下,时区没有生效。 docker run -d --name seata |
弄一台vm机器测试吧,别放docker里了 |
现在就是在虚拟机里。您的意思是在虚拟机里直接部署seata,不使用容器部署是吧? |
对 |
Ⅰ. Issue Description
无法注册分支事务。(偶尔报错)
有时候接口是正常的,有时候接口报错,接口内部还没调用到其他服务就出错了。而且没有超过超时时间,超时时间设置了3分钟,但是接口执行几百毫秒就出错了。检查了seata-server的时区、数据库mariadb的时区、服务器时区、业务pod时区,都一致,时钟也同步。
Ⅱ. Describe what happened
io.seata.core.exception.GlobalTransactionException: Could not register branch into global session xid = 192.168.130.21:8091:18590791467253775 status = TimeoutRollbacking while expecting Begin
at io.seata.server.coordinator.AbstractCore.globalSessionStatusCheck(AbstractCore.java:108) ~[classes/:na]
at io.seata.server.coordinator.AbstractCore.lambda$branchRegister$0(AbstractCore.java:78) ~[classes/:na]
at io.seata.server.storage.db.session.DataBaseSessionManager.lockAndExecute(DataBaseSessionManager.java:194) ~[classes/:na]
at io.seata.server.session.SessionHolder.lockAndExecute(SessionHolder.java:331) ~[classes/:na]
at io.seata.server.coordinator.AbstractCore.branchRegister(AbstractCore.java:77) ~[classes/:na]
at io.seata.server.coordinator.DefaultCore.branchRegister(DefaultCore.java:100) ~[classes/:na]
at io.seata.server.coordinator.DefaultCoordinator.doBranchRegister(DefaultCoordinator.java:199) [classes/:na]
at io.seata.server.AbstractTCInboundHandler$4.execute(AbstractTCInboundHandler.java:184) ~[classes/:na]
at io.seata.server.AbstractTCInboundHandler$4.execute(AbstractTCInboundHandler.java:179) ~[classes/:na]
at io.seata.core.exception.AbstractExceptionHandler.exceptionHandleTemplate(AbstractExceptionHandler.java:124) ~[seata-core-1.4.2.jar:na]
at io.seata.server.AbstractTCInboundHandler.handle(AbstractTCInboundHandler.java:179) [classes/:na]
at io.seata.core.protocol.transaction.BranchRegisterRequest.handle(BranchRegisterRequest.java:136) [seata-core-1.4.2.jar:na]
at io.seata.server.coordinator.DefaultCoordinator.onRequest(DefaultCoordinator.java:473) [classes/:na]
at io.seata.core.rpc.processor.server.ServerOnRequestProcessor.onRequestMessage(ServerOnRequestProcessor.java:116) [seata-core-1.4.2.jar:na]
at io.seata.core.rpc.processor.server.ServerOnRequestProcessor.process(ServerOnRequestProcessor.java:77) [seata-core-1.4.2.jar:na]
at io.seata.core.rpc.netty.AbstractNettyRemoting.lambda$processMessage$2(AbstractNettyRemoting.java:279) [seata-core-1.4.2.jar:na]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[na:1.8.0_212]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[na:1.8.0_212]
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[netty-all-4.1.30.Final.jar:4.1.30.Final]
at java.lang.Thread.run(Thread.java:748) ~[na:1.8.0_212]
Ⅲ. Describe what you expected to happen
Ⅳ. How to reproduce it (as minimally and precisely as possible)
Minimal yet complete reproducer code (or URL to code):
Ⅴ. Anything else we need to know?
Ⅵ. Environment:
JDK version : 1.8
Seata version: 1.4.2
OS : linux centos 7
Others:
The text was updated successfully, but these errors were encountered: