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

Infinite loop in AvaticaHttpClient when response status code is 503

Attach filesAttach ScreenshotAdd voteVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: avatica
    • Labels:
      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

            • Assignee:
              Unassigned
              Reporter:
              leotu Leo Tu

              Dates

              • Created:
                Updated:

                Issue deployment