Aias00 opened a new issue, #7440:
URL: https://github.com/apache/shenyu/issues/7440

   ## Is there an existing issue for this?
   
   - [x] I searched existing open and closed issues.
   
   ## Current Behavior
   
   HTTP client registration can report a failed admin operation as a completed 
client operation, bypassing failback retry.
   
   `RegisterUtils.doRegister()` checks whether the response body equals 
`Constants.SUCCESS`. A different body is logged as an error, but the method 
returns normally. `HttpClientRegisterRepository.doRegister()` only propagates 
failures when an exception is thrown; the failback layer therefore cannot 
distinguish this logged registration failure from success.
   
   The heartbeat helper uses the same log-and-return behavior for non-success 
bodies. Unregistration also logs rather than propagating these response 
failures, although its lifecycle/retry expectations should be considered 
separately.
   
   ## Expected Behavior
   
   A rejected or failed admin operation should reach the caller as an explicit 
failure. Transient registration failures should remain eligible for failback 
retry, while permanent validation failures should be reported according to a 
documented policy.
   
   ## Steps To Reproduce
   
   1. Configure the HTTP registration client against an admin endpoint or test 
server.
   2. Return a non-success response body for a URI/metadata registration 
request, for example a transient server-error body.
   3. Invoke registration through `HttpClientRegisterRepository` and the 
failback path.
   4. Observe an error log but a normal return and no failed registration 
recorded for retry.
   
   A regression can mock `OkHttpTools.post()` to return a non-success body and 
assert that the repository/failback observes a failure. Existing 
`RegisterUtilsTest.testDoRegisterWhenError` only checks that the helper returns 
normally for the error response.
   
   ## Environment
   
   ShenYu `2.7.2-SNAPSHOT`, `master` at 
`67596c1d228b62da75cd0a0ecb47d0ac5d995384`, HTTP client registration.
   
   ## Location And Impact
   
   - 
[RegisterUtils.java:65](https://github.com/apache/shenyu/blob/67596c1d228b62da75cd0a0ecb47d0ac5d995384/shenyu-register-center/shenyu-register-client/shenyu-register-client-http/src/main/java/org/apache/shenyu/register/client/http/utils/RegisterUtils.java#L65):
 logs non-success registration without throwing.
   - 
[RegisterUtils.java:105](https://github.com/apache/shenyu/blob/67596c1d228b62da75cd0a0ecb47d0ac5d995384/shenyu-register-center/shenyu-register-client/shenyu-register-client-http/src/main/java/org/apache/shenyu/register/client/http/utils/RegisterUtils.java#L105):
 equivalent heartbeat behavior.
   - 
[HttpClientRegisterRepository.java:216](https://github.com/apache/shenyu/blob/67596c1d228b62da75cd0a0ecb47d0ac5d995384/shenyu-register-center/shenyu-register-client/shenyu-register-client-http/src/main/java/org/apache/shenyu/register/client/http/HttpClientRegisterRepository.java#L216):
 normal helper return is accepted as completion.
   
   Severity: Medium. Confidence: high. A transient admin failure with a 
response body can silently lose registration without activating the intended 
retry mechanism.
   
   ## Suggested Fix And Regression Coverage
   
   Propagate non-success operation results as an exception or typed failure 
that the repository/failback understands. Define which failures are retryable, 
retain multi-admin delivery behavior, and ensure a successful retry removes 
only the corresponding failure. Add repository/failback tests for 
response-level failure rather than only thrown I/O failures.
   
   ## Validation And Related Issues
   
   The HTTP registration module's targeted tests passed 24 tests with zero 
failures. Existing tests do not assert failback scheduling after a non-success 
response body. No running admin/gateway deployment was used.
   
   An independent verifier traced the repository exception path into 
`FailbackRegistryRepository` and confirmed that response-level logged errors 
never enter its failure queue.
   
   #6559 fixed partial multi-server failures when an exception was thrown. This 
issue is the response-level failure path that throws no exception, so that fix 
cannot observe it.
   


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