You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@knox.apache.org by "James Chen (Jira)" <ji...@apache.org> on 2019/11/04 23:11:00 UTC

[jira] [Updated] (KNOX-2095) Many errors (E.G. 504s) being masked as 500 errors

     [ https://issues.apache.org/jira/browse/KNOX-2095?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

James Chen updated KNOX-2095:
-----------------------------
    Attachment: jamchen504patch.patch
        Status: Patch Available  (was: Open)

Patch works locally on a custom version of knox. To use, adjust the gateway-site.xml to 1 (I.E. 1 ms). A 504 error should be returned instead of the usual 500 error.

> Many errors (E.G. 504s) being masked as 500 errors
> --------------------------------------------------
>
>                 Key: KNOX-2095
>                 URL: https://issues.apache.org/jira/browse/KNOX-2095
>             Project: Apache Knox
>          Issue Type: Improvement
>    Affects Versions: 1.2.0
>            Reporter: James Chen
>            Priority: Major
>              Labels: easyfix
>         Attachments: jamchen504patch.patch
>
>   Original Estimate: 168h
>  Remaining Estimate: 168h
>
> When errors occur while accessing the Knox gateway, errors are forcibly overridden and represented as 500 errors, rather than whatever errors they should be.
> For example, when the timeout value under gateway.httpclient.socketTimeout is set to a very low timeout value (E.G. 1 ms) under gateway-site.xml, a socket timeout exception is produced by the getHttpClient().execute( outboundRequest) call. However, this is caught by the surrounding try-catch block and thrown again as an IOException. This results in a generic 500 error, rather than a 504 error one would normally expect from this sort of interaction.
>  
> For these sorts of scenarios, I believe it would be prudent to create a dummy HttpResponse using a HttpResponseFactory object for the inboundResponse with the corresponding error code (E.G. HttpStatus.SC_GATEWAY_TIMEOUT in the event of a SocketTimeoutException) and return that instead to trigger the appropriate 504 error. I suspect there are other sorts of potential error code triggers that get this same IOException treatment that would be better off receiving their own error codes.
>  
> Judging from the source code, this issue likely affects version 1.3.0, though this has not been tested.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)