Copilot commented on code in PR #8199:
URL: https://github.com/apache/incubator-seata/pull/8199#discussion_r3764296922
##########
core/src/main/java/org/apache/seata/core/rpc/netty/AbstractNettyRemotingClient.java:
##########
@@ -145,6 +148,38 @@ public void init() {
clientBootstrap.start();
}
+ private void scheduleReconnectTask() {
+ ReconnectTaskHolder taskHolder = RECONNECT_TASKS.get(transactionRole);
+ if (taskHolder != null && !taskHolder.future.isCancelled() &&
!taskHolder.future.isDone()) {
+ return;
Review Comment:
Returning for an existing role drops this client entirely: the scheduled
runnable and holder both capture only the first client, so the second
initialized client's channel manager/service group is never reconnected.
Destroying the first client also cancels the role task while the second remains
active. Track every live client for the role (and remove/cancel only when the
last one is destroyed), or key tasks by the actual reconnect target rather than
role alone.
##########
core/src/main/java/org/apache/seata/core/rpc/netty/AbstractNettyRemotingClient.java:
##########
@@ -89,6 +93,15 @@ public abstract class AbstractNettyRemotingClient extends
AbstractNettyRemoting
private static final long SCHEDULE_DELAY_MILLS = 60 * 1000L;
private static final long SCHEDULE_INTERVAL_MILLS = 10 * 1000L;
private static final String MERGE_THREAD_PREFIX = "rpcMergeMessageSend";
+ private static final Object RECONNECT_TASK_LOCK = new Object();
+ private static final ScheduledThreadPoolExecutor RECONNECT_EXECUTOR =
+ new ScheduledThreadPoolExecutor(1, new
NamedThreadFactory("NettyClientReconnectTimer", true));
Review Comment:
A single scheduler thread serializes the RM and TM reconnect jobs.
`reconnect()` synchronously iterates servers and `acquireChannel()` can wait
for the 10-second connection timeout per server, so a slow RM reconnect can
delay TM recovery indefinitely (and vice versa), unlike the previous
independent executors. Use enough scheduler workers for independent role tasks,
or make the scheduled callbacks dispatch the blocking reconnect work to a
separate executor.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]