Sean-Walker0 opened a new pull request, #7429:
URL: https://github.com/apache/shenyu/pull/7429

   Fixes #6500
   
   ## Modifications
   
   The periodic watch task in `EurekaInstanceRegisterRepository#watchInstances` 
caught polling errors, logged them, and then **rethrew `ShenyuException` inside 
the `scheduleAtFixedRate` lambda**:
   
   ```java
   } catch (Exception e) {
       LOGGER.error("eureka registry eurekaDiscoveryService watch key: {} 
error", key, e);
       throw new ShenyuException(e);   // escapes the periodic task
   }
   ```
   
   `ScheduledThreadPoolExecutor` suppresses all later executions of a periodic 
task once an exception escapes it, so a single transient Eureka polling error 
permanently stopped the watch — instance up/down changes were never observed 
again until process restart.
   
   The task now logs the failure and returns, letting the next scheduled poll 
retry:
   
   ```java
   } catch (Exception e) {
       // an exception escaping a fixed-rate task suppresses all later 
executions,
       // so a single polling failure must only be logged to keep the watch 
alive
       LOGGER.error("eureka registry eurekaDiscoveryService watch key: {} 
error", key, e);
   }
   ```
   
   The outer `try` around the initial fetch/schedule (which guards setup, not 
polling) is unchanged.
   
   ## Verifying this change
   
   - [x] New 
`EurekaInstanceRegisterRepositoryTest#testWatchInstancesKeepsPollingAfterFailure`
 — the initial fetch returns an empty list, the first scheduled poll throws a 
RuntimeException, the second poll recovers with one instance, and the listener 
must still receive the `ADDED` event. Red on the pre-fix code 
(`WantedButNotInvoked` after the 5s window — the task died after the first 
failure), green after.
   - [x] `./mvnw -pl shenyu-registry/shenyu-registry-eureka -am test -B` — 3/3 
module tests green, checkstyle clean.
   
   ## Notes
   
   - Behavior change: watch polling survives transient errors instead of 
silently dying; error visibility is unchanged (still logged at ERROR with the 
exception).
   - The sibling issues in the periodic-task hardening family (#6495 → PR 
#7406, #6496 → PR #7414) are being fixed separately; this PR only touches the 
Eureka watch task.
   - Orthogonality: no open PR modifies 
`shenyu-registry/shenyu-registry-eureka` (verified against the file lists of 
all 92 open PRs).
   
   Make sure that:
   
   - [x] You have read the [contribution 
guidelines](https://shenyu.apache.org/community/contributor-guide).
   - [x] You submit test cases (unit or integration tests) that back your 
changes.
   - [x] Your local test passed `./mvnw clean install 
-Dmaven.javadoc.skip=true` (module-scoped: 
`shenyu-registry/shenyu-registry-eureka` with `-am`, tests + checkstyle green).


-- 
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]

Reply via email to