zeroflag commented on code in PR #763: URL: https://github.com/apache/knox/pull/763#discussion_r1228133878
########## gateway-provider-ha/src/main/java/org/apache/knox/gateway/ha/dispatch/ConfigurableHADispatch.java: ########## @@ -220,7 +220,7 @@ protected void executeRequest(HttpUriRequest outboundRequest, HttpServletRequest } catch ( IOException e ) { /* if non-idempotent requests are not allowed to failover, unless it's a connection error */ if(!isConnectionError(e.getCause()) && isNonIdempotentAndNonIdempotentFailoverDisabled(outboundRequest)) { - LOG.cannotFailoverNonIdempotentRequest(outboundRequest.getMethod(), e.toString()); + LOG.cannotFailoverNonIdempotentRequest(outboundRequest.getMethod(), e.getCause()); Review Comment: Thanks for the review @moresandeep. I tried it with a null cause, but it did not cause an NPE, it just logged out null. ``` 2023-06-13 15:16:05,205 8a432e79-6f55-4be0-8ef3-fcbe74773e19 ERROR knox.gateway (ConfigurableHADispatch.java:executeRequest(222)) - Request is non-idempotent POST, failover prevented, to allow non-idempotent requests to failover set failoverNonIdempotentRequestEnabled=true in HA config. Non connection related error: null ``` But this shouldn't happen because we always wrap the cause into an IOException, so the cause shouldn't be empty. My problem with the `toString` was, that it didn't reveal the actual cause (which is used to make the decision whether to fail over or not). Here is how the message looked like before (using the `toString`): ``` 2023-06-12 15:09:28,865 30b4e772d8617006eca9b589eda16813 ERROR knox.gateway (ConfigurableHADispatch.java:executeRequest(223)) - Request is non-idempotent POST, failover prevented, to allow non-idempotent requests to failover set failoverNonIdempotentRequestEnabled=true in HA config. Non connection related error: java.io.IOException: Service connectivity error. ``` Basically the error message was always the same regardless the error. From this message I can't see if the error happened because of a connection timeout or connection refused or any other reason. Now it looks like: ``` 2023-06-13 13:14:20,843 34dd13f0-324b-421e-b6e6-5947e0e38440 ERROR knox.gateway (ConfigurableHADispatch.java:executeRequest(223)) - Request is non-idempotent POST, failover prevented, to allow non-idempotent requests to failover set failoverNonIdempotentRequestEnabled=true in HA config. Non connection related error: javax.net.ssl.SSLException: java.net.SocketException: Socket closed ``` -- 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: dev-unsubscr...@knox.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org