[ 
https://issues.apache.org/jira/browse/KNOX-3381?focusedWorklogId=1030900&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-1030900
 ]

ASF GitHub Bot logged work on KNOX-3381:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 17/Jul/26 10:44
            Start Date: 17/Jul/26 10:44
    Worklog Time Spent: 10m 
      Work Description: hanicz opened a new pull request, #1308:
URL: https://github.com/apache/knox/pull/1308

   …ing writeOutboundResponse
   
   [KNOX-3381](https://issues.apache.org/jira/browse/KNOX-3381) - HADispatch 
retries on IOException during writeOutboundResponse
   
   ## What changes were proposed in this pull request?
   
   Failover dispatches wrapped both the backend call and the response-copy in 
one try, so an `IOException` while streaming an already-received response to 
the client (e.g. a parse/rewrite error) triggered a failover — replaying a 
request the backend had already served. Split the two phases so only 
backend-connection failures fail over; response-copy errors now propagate. 
Applied to `ConfigurableHADispatch` and the `Atlas/NiFi `HA dispatches, plus a 
new test.
   
   ## How was this patch tested?
   
   Unit tests, tested locally with custom REST endpoints
   
   ## Integration Tests
   N/A
   
   ## UI changes
   N/A




Issue Time Tracking
-------------------

            Worklog Id:     (was: 1030900)
    Remaining Estimate: 0h
            Time Spent: 10m

> HADispatch retries on IOException during writeOutboundResponse
> --------------------------------------------------------------
>
>                 Key: KNOX-3381
>                 URL: https://issues.apache.org/jira/browse/KNOX-3381
>             Project: Apache Knox
>          Issue Type: Bug
>          Components: Server
>    Affects Versions: 2.1.0
>            Reporter: Tamás Hanicz
>            Assignee: Tamás Hanicz
>            Priority: Major
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> HADispatch fails over on IOExceptions thrown while writing the response, not 
> just on connection failures
> ConfigurableHADispatch.executeRequest(...) wraps both the backend call and 
> the response-writing in a single try/catch and triggers failover on any 
> IOException:
> {code:java}
> try {
>   inboundResponse = executeOutboundRequest(outboundRequest);
>   writeOutboundResponse(outboundRequest, inboundRequest, outboundResponse, 
> inboundResponse); // stream/rewrite body to client
> } catch (IOException e) {
>   if (!isConnectionError(e.getCause()) && 
> isNonIdempotentAndNonIdempotentFailoverDisabled(outboundRequest)) {
>     ...
>     throw e;
>   } else {
>     failoverRequest(outboundRequest, inboundRequest, outboundResponse, 
> inboundResponse, e);
>   }
> }{code}
>  
> Failover is only meant to occur when Knox cannot get a response from a 
> backend (connection-level errors — UnknownHostException, 
> NoRouteToHostException, SocketException, ConnectTimeoutException). However, 
> because writeOutboundResponse(...) is inside the same try block, an 
> IOException raised after a response has already been received — e.g. while 
> streaming or rewriting the response body — also lands in the catch and 
> triggers failover.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to