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

   ## Current Behavior
   
   The Netty HTTP client rejects a valid three-digit upstream status when it is 
not present in Spring's `HttpStatus` enum and the response has been wrapped by 
a built-in plugin.
   
   `NettyHttpClientPlugin` handles enum statuses through 
`ServerHttpResponse.setStatusCode`, but for other codes it calls 
`setRawStatusCode` only when the response is an `AbstractServerHttpResponse`. A 
`ServerHttpResponseDecorator` fails that concrete-type check, so the client 
throws `IllegalStateException` before returning the upstream response.
   
   This is reachable with the built-in `loggingConsole` plugin: its order is 
160, before `nettyHttpClient` (210), and it installs its own 
`LoggingServerHttpResponse` decorator. No third-party response wrapper is 
required.
   
   ## Reproduction
   
   An in-process Reactor Netty HTTP server bound to `127.0.0.1` on an ephemeral 
port returned either 200 or 529 with the same body, `upstream-payload`.
   
   The probe compiles current Netty/abstract HTTP client and retry sources plus 
the actual `LoggingConsolePlugin` and its handle classes. It calls the public 
HTTP client `execute()` method with the default current retry strategy and 
`HTTP_RETRY=0`. For the decorated cases, a small subclass exposes the logging 
plugin's real `doExecute`, which installs its actual request/response 
decorators. A terminal chain consumes the actual upstream connection body and 
records it; the incoming exchange is a WebFlux mock.
   
   ```text
   UPSTREAM=200 LOGGING=false RESPONSE_CLASS=MockServerHttpResponse 
OUTCOME=success STATUS=200 BODY=upstream-payload
   UPSTREAM=200 LOGGING=true RESPONSE_CLASS=LoggingServerHttpResponse 
OUTCOME=success STATUS=200 BODY=upstream-payload
   UPSTREAM=529 LOGGING=false RESPONSE_CLASS=MockServerHttpResponse 
OUTCOME=success STATUS=529 BODY=upstream-payload
   UPSTREAM=529 LOGGING=true RESPONSE_CLASS=LoggingServerHttpResponse 
OUTCOME=ResponseStatusException STATUS=null BODY=
   ```
   
   The public execution failure is `408 REQUEST_TIMEOUT`, because the default 
retry strategy classifies the resulting `IllegalStateException` as retryable 
and maps exhausted attempts to a timeout even with zero retries.
   
   A second call exposes the actual HTTP request method directly, under the 
same logging wrapper, to isolate the original failure before retry translation:
   
   ```text
   RAW_CALLBACK_FAILURE=IllegalStateException: Unable to set status code on 
response: 529, class 
org.apache.shenyu.plugin.logging.console.LoggingConsolePlugin$LoggingServerHttpResponse
   ```
   
   Both server and client traffic are real loopback HTTP. The terminal fixture 
drains upstream data rather than executing the complete gateway response-writer 
chain, so this demonstrates status propagation, the concrete failure and lost 
handoff, not a full dashboard-configured gateway deployment.
   
   ## Expected Behavior And Impact
   
   Proxy valid upstream status codes through the `ServerHttpResponse` interface 
regardless of built-in response decoration. Enabling logging should not replace 
a 529 response with a timeout error or prevent its body from reaching the 
response writer.
   
   Priority: P2 / Medium. Confidence: high for the reproduced loggingConsole + 
Netty path. Other wrappers were inspected but are not claimed as executed 
reproductions.
   
   ## Locations And Suggested Fix
   
   - 
[NettyHttpClientPlugin.java:124](https://github.com/apache/shenyu/blob/b2bc43376a0146684faf6d45a6832d201fc61f45/shenyu-plugin/shenyu-plugin-httpclient/src/main/java/org/apache/shenyu/plugin/httpclient/NettyHttpClientPlugin.java#L124):
 enum lookup followed by an unnecessarily concrete response-type requirement.
   - 
[LoggingConsolePlugin.java:101](https://github.com/apache/shenyu/blob/b2bc43376a0146684faf6d45a6832d201fc61f45/shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-console/src/main/java/org/apache/shenyu/plugin/logging/console/LoggingConsolePlugin.java#L101):
 real logging response decoration before the HTTP client.
   - 
[DefaultRetryStrategy.java:75](https://github.com/apache/shenyu/blob/b2bc43376a0146684faf6d45a6832d201fc61f45/shenyu-plugin/shenyu-plugin-httpclient/src/main/java/org/apache/shenyu/plugin/httpclient/DefaultRetryStrategy.java#L75):
 translates the original state error into a timeout after retry exhaustion.
   
   Use a status-setting API that accepts non-enum `HttpStatusCode` values 
through `ServerHttpResponse`, such as 
`setStatusCode(HttpStatusCode.valueOf(code))`, without requiring an undecorated 
implementation. Preserve the upstream status and response body through ordinary 
decorators.
   
   ## Environment And Related Issues
   
   Apache ShenYu `2.7.2-SNAPSHOT`, `master` at 
`b2bc43376a0146684faf6d45a6832d201fc61f45`.
   
   - #6765 concerns a cast in error logging after `ResponseStatusException`. 
Here the original failure is in HTTP response propagation before any such error 
is needed.
   - #6719 concerns a cast in `GlobalErrorHandler`; this probe does not invoke 
that handler.
   - #6734 concerns failover on upstream 5xx. This reproduction uses the 
current/default retry strategy and no failover configuration; an undecorated 
529 succeeds.
   - Historical issue titles, related issue bodies, live searches for the exact 
failure/529/non-enum Netty status and current open PR titles were checked 
before filing.
   


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