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

HA Dispatch implementations should differentiate IOExceptions

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.1.0
    • 2.1.0
    • Server
    • None

    Description

      The HA Dispatch implementations catch IOException, and initiate failover logic regardless of the type of error the exception represents. For instance, some IOExceptions indicate interrupted data transfer while others represent connection errors.

      This distinction is especially important for PUT and POST requests, for which InputStreamEntity is used for the content. InputStreamEntity is a non-repeatable entity type, making the results of subsequent attempts unreliable.

      We should probably only failover / retry on connection-related IOException types:

      • java.net.SocketException
      • java.net.UnknownHostException

      And return an error response to the client for other IOException types. Maybe it makes sense to consider the HTTP method to make this decision (e.g., retry GET requests, but not PUT or POST).

      The affected dispatch implementations includes at least:

      • org.apache.knox.gateway.ha.dispatch.DefaultHaDispatch
      • org.apache.knox.gateway.ha.dispatch.AtlasApiHaDispatch
      • org.apache.knox.gateway.ha.dispatch.AtlasHaDispatch
      • org.apache.knox.gateway.dispatch.NiFiHaDispatch
      • org.apache.knox.gateway.hdfs.dispatch.AbstractHdfsHaDispatch

       

      If retry is configured, but we won't retry, then perhaps java.net.HttpRetryException should be thrown.

       

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              pzampino Philip Zampino
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated: