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

[jira] [Updated] (CALCITE-3134) Infinite loop in AvaticaHttpClient when response status code is 503

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

Stamatis Zampetakis updated CALCITE-3134:
-----------------------------------------
    Summary: Infinite loop in AvaticaHttpClient when response status code is 503  (was: Avatica Remote JDBC HttpClient may run Infinite loop)

> Infinite loop in AvaticaHttpClient when response status code is 503
> -------------------------------------------------------------------
>
>                 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)