Aias00 opened a new issue, #6495:
URL: https://github.com/apache/shenyu/issues/6495
### Current Behavior
Cluster master election/renewal can stop permanently after one exception
escapes the scheduled task.
`ShenyuClusterService.startSelectMasterTask()` schedules master selection
with `scheduleAtFixedRate(...)`:
```java
executorService.scheduleAtFixedRate(() -> doSelectMaster(host, port,
contextPath), ...);
```
`doSelectMaster()` catches exceptions, closes the check services, and then
throws a new `ShenyuException`:
```java
} catch (Exception e) {
LOG.error("select master error", e);
upstreamCheckService.close();
instanceCheckService.close();
throw new ShenyuException(...);
}
```
For `ScheduledThreadPoolExecutor`, an exception escaping a fixed-rate task
suppresses later executions of that periodic task. A transient lock/renewal
failure can therefore stop future master selection attempts in that process.
### Expected Behavior
Master election/renewal errors should be logged and the next scheduled
election attempt should still run. Exceptions should not escape the periodic
scheduler task.
### Impact
After a transient cluster backend failure, the admin node may stop
participating in master election until it is restarted.
### Code Location
-
`shenyu-admin/src/main/java/org/apache/shenyu/admin/mode/cluster/service/ShenyuClusterService.java`
- `startSelectMasterTask()` schedules the periodic task.
- `doSelectMaster()` rethrows from the catch block.
--
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]