apache / apache/shenyu

[BUG] doUnregister swallows all offline exceptions — offline failures never retried, leaving stale upstreams

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

Description

- Severity: Medium
- Location:
`HttpClientRegisterRepository.java:232-246` (`doUnregister`), called from `offline()` (`:131-133`) and the per-URI shutdown hook `ShenyuClientURIExecutorSubscriber:109`
-
Description:
`doUnregister` catches `Exception` per server, logs, and never throws — it lacks the `if (i == serverList.size()) throw new RuntimeException(e)` that `doRegister` (`:205-207`) and `doHeartbeat` (`:225-227`) have. `offline()` is not wrapped by `FailbackRegistryRepository.persist*`, so no failback retry is enqueued. This is the *only* offline mechanism (the per-URI shutdown hook also routes through `offline()`). If all admin servers are unreachable at shutdown, the offline is silently lost.
-
Impact:
Stale upstream entries after client shutdown when admin is temporarily unavailable; gateway may route traffic to dead instances during the health-check grace window.
-
Suggested fix:
Throw on last-server failure (mirroring `doRegister`) and/or route offline through a failback retry; alternatively document as best-effort.
-
Confidence: Medium
- Related existing: none — #6559/FUNC-E4 concerns `doRegister` partial-failure; #6487 concerns the heartbeat scheduler. `doUnregister` is a distinct method with no retry.

---
_Identified during the 2026-08-02 deep re-scan; full list in [`docs/scan2-2026-08-02/06-medium-tiers.md`](docs/scan2-2026-08-02/06-medium-tiers.md)._

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with HttpClientRegisterRepository.java:131-133 and 232-246, then compare doUnregister with doRegister and doHeartbeat at the cited lines. Trace the offline() calls from ShenyuClientURIExecutorSubscriber.java:109 and verify how failures are handled when every server is unavailable. Done means offline failures are no longer silently lost and the intended retry or failure behavior is covered.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.