incubator-seata icon indicating copy to clipboard operation
incubator-seata copied to clipboard

[pc.netty.AbstractNettyRemoting]: 0104 ==> java.lang.RuntimeException: channel is error.

Open lu1235353884 opened this issue 1 year ago • 3 comments

  • [ ] I have searched the issues of this repository and believe that this is not a duplicate.

Ⅰ. Issue Description

项目中使用seataAT模式解决分布式事务,在全局事务开始时就出现RPC timeout 30000,导致全局事务开启失败; 项目中使用restful实现分布式服务间服务调用,nacos做注册中心,seata解决分布式事务;

Ⅱ. Describe what happened

项目中使用seata解决分布式事务,使用过程中偶现该问题,在全局事务开始时就出现RPC timeout 30000;

seata client 报错如下:wait response error:cost 30000,导致全局事务开启失败。 Seata server报错如下:

00:20:21.830 INFO --- [ batchLoggerPrint_1_1] [ocessor.server.BatchLogHandler] [ run] [] : receive msg[single]: GlobalBeginRequest{transactionName=XXXXXX', timeout=6000000}, clientIp: XXXXXX, vgroup: default_tx_group 00:20:28.930 INFO --- [ettyServerNIOWorker_1_4_8] [ty.AbstractNettyRemotingServer] [ handleDisconnect] [] : xxxxx:xx to server channel inactive. 00:20:28.930 INFO --- [ettyServerNIOWorker_1_4_8] [ty.AbstractNettyRemotingServer] [ handleDisconnect] [] : remove channel:[id: 0x06609bc3, L:/10.192.19.108:8091 ! R:/10.192.23.34:48020]context:RpcContext{applicationId='APC', transactionServiceGroup='default_tx_group', clientId='APC:XXXXX:XX', channel=[id: 0x06609bc3, L:/10.192.19.108:8091 ! R:/10.192.23.34:48020], resourceSets=null} 00:20:30.354 INFO --- [verHandlerThread_1_42_500] [coordinator.DefaultCoordinator] [ doGlobalBegin] [XXXXXX:XX:6296547817037284291] : Begin new global transaction applicationId: APC,transactionServiceGroup: default_tx_group, transactionName: wo.op.report.picking.return.create,timeout:6000000,xid:XXXXXXX:XX:6296547817037284291 00:20:30.355 ERROR --- [verHandlerThread_1_42_500] [pc.netty.AbstractNettyRemoting] [bda$processMessage$2] [XXXXXXX:XX:6296547817037284291] : 0104 ==> java.lang.RuntimeException: channel is error. at io.seata.core.rpc.netty.AbstractNettyRemotingServer.sendAsyncResponse(AbstractNettyRemotingServer.java:106) ~[seata-core-1.7.0.jar:1.7.0] at io.seata.core.rpc.processor.server.ServerOnRequestProcessor.onRequestMessage(ServerOnRequestProcessor.java:207) ~[seata-core-1.7.0.jar:1.7.0] at io.seata.core.rpc.processor.server.ServerOnRequestProcessor.process(ServerOnRequestProcessor.java:122) ~[seata-core-1.7.0.jar:1.7.0] at io.seata.core.rpc.netty.AbstractNettyRemoting.lambda$processMessage$2(AbstractNettyRemoting.java:281) ~[seata-core-1.7.0.jar:1.7.0] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[na:1.8.0_342] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[na:1.8.0_342] at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[netty-common-4.1.76.Final.jar:4.1.76.Final] at java.lang.Thread.run(Thread.java:750) ~[na:1.8.0_342] <== Just paste your stack trace here!



### Ⅲ. Describe what you expected to happen


### Ⅳ. How to reproduce it (as minimally and precisely as possible)

1. xxx
2. xxx
3. xxx

Minimal yet complete reproducer code (or URL to code):



### Ⅴ. Anything else we need to know?


### Ⅵ. Environment:

JDK version 1.8:
Seata version 1.7.0:
OS微软云平台:
mysql 5.7

lu1235353884 avatar Apr 30 '24 03:04 lu1235353884

客户端连接断开了,找不到channel可以下发请求 The client end connection is disconnected, and the channel cannot be found to issue a request.

funky-eyes avatar Apr 30 '24 03:04 funky-eyes

Check whether the application is restarting and publishing.

slievrly avatar Apr 30 '24 06:04 slievrly

@funky-eyes @slievrly

I guess that error message from this line

What about fix two minor things?

  1. Chagne error message from "channel is error." to Unable to find the client's channel for response | responseBody: " + msg. I guess this issue is about cannot find channel context when response due to channel context from local context is deleted. Maybe the reason is application was restarted @slievrly mentiond. So i think message that i suggest might be more clear 😅

  2. For clarity, refactor code using return early pattern

if (channel == null) { RuntimeException("") }
RpcMessage rpcMsg = buildResponseMessage(rpcMessage, msg, msg instanceof HeartbeatMessage
...
...

If these looks okay then I would create a PR.

YeonCheolGit avatar May 05 '24 16:05 YeonCheolGit