[
https://issues.apache.org/jira/browse/KNOX-3381?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18097484#comment-18097484
]
ASF subversion and git services commented on KNOX-3381:
-------------------------------------------------------
Commit b438768cd87b96d0bcc677745e3c39acb5e4d72d in knox's branch
refs/heads/master from hanicz
[ https://gitbox.apache.org/repos/asf?p=knox.git;h=b438768cd ]
KNOX-3381: Fix HaDispatch unnecessary failover due to IOException during
writeOutboundResponse (#1308)
> 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: 0.5h
> 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)