prestodb/presto · error · PrestoException

REST_SERVER_TIMEOUT

REST_SERVER_TIMEOUT

Error message

Request to REST server timed out. Request: 

What it means

SqlFunctionResultResponseHandler.handleException maps java.net.SocketTimeoutException to this error: the REST function-namespace server did not respond in time while invoking a SqlFunction, so the remote function call timed out.

Source

Thrown at presto-function-namespace-managers/src/main/java/com/facebook/presto/functionNamespace/rest/RestSqlFunctionExecutor.java:166

        URI baseUri = restFunctionHandle.getExecutionEndpoint()
                .orElse(URI.create(restBasedFunctionNamespaceManagerConfig.getRestUrl()));
        String path = format("/v1/functions/%s/%s/%s/%s",
                functionId.getFunctionName().getSchemaName(),
                functionId.getFunctionName().getObjectName(),
                encodedFunctionId,
                functionVersion);

        return URI.create(String.format("%s%s", baseUri, path));
    }

    public static class SqlFunctionResultResponseHandler
            implements ResponseHandler<SqlFunctionResult, RuntimeException>
    {
        @Override
        public SqlFunctionResult handleException(Request request, Exception exception)
        {
            if (exception instanceof java.net.SocketTimeoutException) {
                throw new PrestoException(REST_SERVER_TIMEOUT, "Request to REST server timed out. Request: " + request, exception);
            }
            else if (exception instanceof java.net.ConnectException) {
                throw new PrestoException(REST_SERVER_CONNECT_ERROR, "Failed to connect to REST server. Request: " + request, exception);
            }
            else {
                throw new PrestoException(REST_SERVER_ERROR, "Unexpected error during REST call. Request: " + request + ", Exception: " + exception.getMessage(), exception);
            }
        }

        @Override
        public SqlFunctionResult handle(Request request, Response response)
        {
            if (response.getStatusCode() == HTTP_NOT_FOUND) {
                throw new PrestoException(REST_SERVER_NOT_FOUND, "Resource not found on REST server. Request: " + request);
            }
            else if (response.getStatusCode() == HTTP_SERVER_ERROR) {
                throw new PrestoException(REST_SERVER_ERROR, "Internal server error on REST server. Request: " + request);
            }

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Increase the REST client read timeout configuration
  2. Check function-namespace server load and latency
  3. Retry the query once the server responds within the timeout
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at presto-function-namespace-managers/src/main/java/com/facebook/presto/functionNamespace/rest/RestSqlFunctionExecutor.java:166 when the library encounters an invalid state.

Common situations: See trigger scenarios.

Understand the failure class


AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04). Data as JSON: /api/errors/467ef426fd1100c1. Report an issue: GitHub.