You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Leo Tu (JIRA)" <ji...@apache.org> on 2019/06/18 16:48:00 UTC

[jira] [Created] (CALCITE-3134) Avatica Remote JDBC HttpClient may run Infinite loop

Leo Tu created CALCITE-3134:
-------------------------------

             Summary: Avatica Remote JDBC HttpClient may run Infinite loop
                 Key: CALCITE-3134
                 URL: https://issues.apache.org/jira/browse/CALCITE-3134
             Project: Calcite
          Issue Type: Improvement
          Components: avatica
            Reporter: Leo Tu


The implementation of AvaticaHttpClient
 * org.apache.calcite.avatica.remote.AvaticaHttpClientImpl

or 
 * org.apache.calcite.avatica.remote.AvaticaCommonsHttpClientImpl

 

"while (true) ... continue"

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

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

 

 

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

{color:#FF0000}*public* *byte*[] send(*byte*[] request){color} {

    {color:#FF0000}*while* (*true*) {{color}

     ...

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

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

            *if* (HttpURLConnection.*_HTTP_OK_* == statusCode

            ...

      {color:#FF0000}      {color}{color:#FF0000}} *else* *if* (HttpURLConnection.*_HTTP_UNAVAILABLE_* == statusCode) {{color}

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

              {color:#FF0000}*continue*;{color}

           }

       } *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);

      }

    ...

 

 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)