Aias00 opened a new issue, #6487:
URL: https://github.com/apache/shenyu/issues/6487
### Current Behavior
Client heartbeat reporting can permanently stop after one heartbeat cycle
fails against all configured admin servers.
The heartbeat tasks are scheduled with `scheduleAtFixedRate(...)`:
```java
executor.scheduleAtFixedRate(() -> URIS.forEach(this::sendHeartbeat), 30,
10, TimeUnit.SECONDS);
```
The HTTP register repository throws from the heartbeat path when the last
admin server fails or when an access token cannot be resolved:
```java
if (StringUtils.isBlank(accessToken)) {
throw new NullPointerException("accessToken is null");
}
...
if (i == serverList.size()) {
throw new RuntimeException(e);
}
```
For `ScheduledThreadPoolExecutor.scheduleAtFixedRate`, an exception escaping
the task suppresses subsequent executions of that periodic task. So a single
full-cluster outage or token failure can stop future heartbeats until the
client process restarts.
### Expected Behavior
A failed heartbeat cycle should be logged and retried on the next scheduled
run. Exceptions should not escape the periodic heartbeat runnable.
### Steps to Reproduce
1. Configure a Shenyu client with HTTP register/heartbeat enabled.
2. Make all configured admin servers temporarily unreachable, or make token
acquisition return blank.
3. Let one heartbeat cycle run.
4. Restore admin availability.
5. The scheduled heartbeat task may no longer run because the prior
exception escaped the fixed-rate task.
### Code Location
-
`shenyu-client/shenyu-client-core/src/main/java/org/apache/shenyu/client/core/disruptor/subcriber/ShenyuClientURIExecutorSubscriber.java`
-
`shenyu-register-center/shenyu-register-client-beat/src/main/java/org/apache/shenyu/register/client/beat/HeartbeatListener.java`
-
`shenyu-register-center/shenyu-register-client/shenyu-register-client-http/src/main/java/org/apache/shenyu/register/client/http/HttpClientRegisterRepository.java`
--
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]