Uploaded image for project: 'Apache Knox'
  1. Apache Knox
  2. KNOX-2095

Many errors (E.G. 504s) being masked as 500 errors

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Abandoned
    • 1.2.0, 1.3.0
    • 1.6.0
    • None
    • Patch, Important

    Description

      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.

      Attachments

        1. KNOX-2095.patch
          12 kB
          James Chen
        2. jamchen504patch.patch
          3 kB
          James Chen

        Issue Links

          Activity

            People

              jamchen James Chen
              jamchen James Chen
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - 168h
                  168h
                  Remaining:
                  Time Spent - 3h Remaining Estimate - 165h
                  165h
                  Logged:
                  Time Spent - 3h Remaining Estimate - 165h
                  3h