apache / apache/shenyu

[BUG] Eureka instance watch task can stop after one polling error

Open Beginner friendly
#6,500 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
8.8k
Forks
3.1k
Avg merge
7d 1h
Merged PRs (30d)
85

Description

### Current Behavior

Eureka instance watch polling can stop permanently after one polling error.

`EurekaInstanceRegisterRepository.watchInstances()` schedules a fixed-rate polling task. The task catches exceptions, logs them, and then rethrows as `ShenyuException`:

```java
ScheduledFuture scheduledFuture = executorService.scheduleAtFixedRate(() -> {
try {
...
} catch (Exception e) {
LOGGER.error("eureka registry eurekaDiscoveryService watch key: {} error", key, e);
throw new ShenyuException(e);
}
}, 0, 1, TimeUnit.SECONDS);
```

An exception escaping a `ScheduledThreadPoolExecutor` periodic task suppresses subsequent executions. So a single transient Eureka client error can stop future instance polling for that watched key.

### Expected Behavior

Eureka watch polling should log transient errors and retry in the next scheduled interval without letting exceptions escape the periodic task.

### Impact

After one polling error, instance add/delete changes for the watched service can stop propagating until the watcher is recreated or the process restarts.

### Code Location

- `shenyu-registry/shenyu-registry-eureka/src/main/java/org/apache/shenyu/registry/eureka/EurekaInstanceRegisterRepository.java`
- `watchInstances()` rethrows from inside the scheduled polling task.

Contributor guide

No contributing guide indexed for this repository

Research direction

Read shenyu-registry/shenyu-registry-eureka/src/main/java/org/apache/shenyu/registry/eureka/EurekaInstanceRegisterRepository.java, starting with watchInstances() and its scheduleAtFixedRate task. Confirm how the caught error currently escapes, then ensure transient polling errors are logged without stopping future intervals. Done means instance polling continues after an error and later add/delete changes still propagate.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend, distributed-systems
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.