risdenk commented on a change in pull request #177: [WIP] KNOX-2095 - Adding in
DefaultDispatch code and tests to handle 504 errors
URL: https://github.com/apache/knox/pull/177#discussion_r344900248
##########
File path:
gateway-spi/src/main/java/org/apache/knox/gateway/dispatch/DefaultDispatch.java
##########
@@ -138,6 +144,10 @@ protected HttpResponse executeOutboundRequest(
HttpUriRequest outboundRequest )
}
}
auditor.audit( Action.DISPATCH, outboundRequest.getURI().toString(),
ResourceType.URI, ActionOutcome.SUCCESS, RES.responseStatus( statusCode ) );
+ } catch( SocketTimeoutException e ) {
+ //Set a 504 instead of throwing an IO exception in the event of a
socket timeout,
+ //as an IO exception forces a 500 to be displayed.
Review comment:
Yes one server could be dying or overloaded where the second one isn't. That
would cause socket timeout on one server but failover would work correctly.
There can definitely be socket timeouts in active/passive and active/active
case.
active passive - active server gets overloaded
active/active - could be something wrong on one of the two hosts
Yes you could failover only to have to wait again but that is what failover
is designed to do. You can't just skip failover in some cases since you don't
have enough information to say whether the failover will succeed or not. The
fix for this would be some sort of active list of backend hosts, but Knox
doesn't have that today. That is a bigger feature for sure.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services