Details
-
Improvement
-
Status: Open
-
Major
-
Resolution: Unresolved
-
None
-
None
-
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); }...