yangjj-iso opened a new pull request, #7656:
URL: https://github.com/apache/shenyu/pull/7656
Fixes #6504.
Unchecked login-response parsing errors escape `doLogin()`. During startup,
the initial login runs before the refresh task is scheduled, so a malformed
response can abort initialization. During periodic refresh, the existing outer
exception guard keeps the task alive but the failed server has already
interrupted the server loop, preventing failover to a healthy Admin.
Treat runtime response-processing errors like failed I/O attempts: log the
failure and return `false` for that server. The existing login loop can then
try the next Admin, and an unsuccessful initial login can still schedule later
recovery.
Add seven real OkHttp/WireMock recovery scenarios. The tests capture the
scheduled callback and invoke it directly, without sleeps, covering malformed
response shapes, initial failover, all-invalid startup followed by recovery,
refresh failover, and retention of the last token across a failed interval.
They also verify the existing five-second schedule.
Validation:
- On the original implementation, two startup scenarios throw parsing
exceptions and the periodic failover scenario retains the old token instead of
obtaining the healthy server's token.
- All 64 tests in the HTTP sync module pass after the fix, with zero
failures/errors/skips, including the seven new scenarios.
- Checkstyle and Apache RAT passed across the affected reactor; `git diff
--check` passed.
- Full-repository Maven install and a deployed Admin/gateway cluster were
not run locally.
Focused reproduction:
```sh
./mvnw -B -ntp -pl shenyu-sync-data-center/shenyu-sync-data-http -am test \
-Dtest=AccessTokenManagerRecoveryTest
-Dsurefire.failIfNoSpecifiedTests=false \
-DskipRemoteResources=true -Djacoco.skip=true -Dmaven.javadoc.skip=true
```
- [x] Read the contribution guidelines.
- [x] Submit regression tests.
- [ ] Full local `./mvnw clean install -Dmaven.javadoc.skip=true`
(affected-reactor validation above).
--
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]