Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-3134

Infinite loop in AvaticaHttpClient when response status code is 503

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • avatica
    • None

    Description

      The implementation of AvaticaHttpClient

      • org.apache.calcite.avatica.remote.AvaticaHttpClientImpl

      or 

      • org.apache.calcite.avatica.remote.AvaticaCommonsHttpClientImpl

       

      "while (true) ... 503 continue"

      i have face that client run forever when HTTP code 503.

      (i.e, Nginx proxy gateway failed return 503 code always)

       

       

      -------------  -red color  --------

      public byte[] send(byte[] request) {

          while (true) {

           ...

             try (CloseableHttpResponse response = execute(post, context)) {

                  final int statusCode = response.getStatusLine().getStatusCode();

                  if (HttpURLConnection.HTTP_OK == statusCode

                  ...

                  else if (HttpURLConnection.HTTP_UNAVAILABLE == statusCode

                     LOG.debug("Failed to connect to server (HTTP/503), retrying");

                    continue;

                 }

             } catch (NoHttpResponseException e)

      {           // This can happen when sitting behind a load balancer and a backend server dies            *_LOG_*.debug("The server failed to issue an HTTP response, retrying");            *continue*;       }

      catch (RuntimeException e)

      {           *throw* e;       }

      catch (Exception e)

      {           *_LOG_*.debug("Failed to execute HTTP request", e);           *throw* *new* RuntimeException(e);       }

          ...

       

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            leotu Leo Tu
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: