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:52:00 UTC

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

     [ https://issues.apache.org/jira/browse/CALCITE-3134?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Leo Tu updated CALCITE-3134:
----------------------------
    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-  --------

{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}*else* *if* ({color:#d04437}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);       }

    ...

 

 

  was:
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);

      }

    ...

 

 


> 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
>            Priority: Major
>
> 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-  --------
> {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}*else* *if* ({color:#d04437}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)