apache / apache/shenyu

[BUG] HttpClientRegisterRepository.doRegister only throws on the last server, so partial multi-cluster failures are never retried

Open
#6,559 1 comment 0 reactions 0 assignees View on GitHub
client: register-http priority: medium type: bug
Dominant language
Java
Stars
8.8k
Forks
3.1k
Avg merge
7d 1h
Merged PRs (30d)
85

Description

## Description
`for (String server : serverList) { i++; try { RegisterUtils.doRegister(...); } catch (Exception e) { LOGGER.error(...); if (i == serverList.size()) { throw new RuntimeException(e); } } }`. The `FailbackRegistryRepository.persist*` wrapper only enrolls a failure for retry when `doPersist*` throws. If an *intermediate* server fails but a later server succeeds, no exception is thrown, so no failback task is created. The failed intermediate server never receives that registration/heartbeat.

## Location
```
shenyu-register-client-http/.../HttpClientRegisterRepository.java:191-210 (doRegister), 212-230 (doHeartbeat)
```

## Impact
In multi-cluster deployments (the code comment at line 202 explicitly contemplates multiple clusters), partial registration loss that the failback mechanism never recovers.

## Suggested fix
Track per-server failure and throw if *any* server failed (or enroll a per-server failback task), rather than gating the throw on `i == serverList.size()`.

## Related existing issue(s)
None

_Identified during the 2026-08-02 audit; full list in [`docs/issue-candidates-2026-08-02.md`](docs/issue-candidates-2026-08-02.md)._

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in shenyu-register-client-http/.../HttpClientRegisterRepository.java at lines 191-230, then trace the FailbackRegistryRepository.persist* wrapper to see how exceptions create retry tasks. Exercise registration and heartbeat with multiple servers where an intermediate server fails, and verify that the failure is propagated or enrolled for retry even when a later server succeeds.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend, distributed-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.