prestodb/presto · error · PrestoException

GENERIC_INTERNAL_ERROR

GENERIC_INTERNAL_ERROR

Error message

Request failed with HTTP status 

What it means

In AbstractNativeProcess.doGetServerInfo, the async callback for the native process's /v1/info (server info) HTTP call throws PrestoException(GENERIC_INTERNAL_ERROR) when the native worker responds with any HTTP status other than 200 OK. This means the process started but its server-info endpoint rejected the request, so the process startup handshake fails.

Source

Thrown at presto-spark-base/src/main/java/com/facebook/presto/spark/execution/nativeprocess/AbstractNativeProcess.java:529

            int p = socket.getLocalPort();
            socket.close();
            return p;
        }
        catch (Exception ex) {
            // Something is wrong with the executor — fail it.
            throw new PrestoSparkFatalException("Failed to acquire port on host", ex);
        }
    }

    private void doGetServerInfo(SettableFuture<ServerInfo> future)
    {
        addCallback(serverClient.getServerInfo(), new FutureCallback<BaseResponse<ServerInfo>>()
        {
            @Override
            public void onSuccess(@Nullable BaseResponse<ServerInfo> response)
            {
                if (response.getStatusCode() != SC_OK) {
                    throw new PrestoException(GENERIC_INTERNAL_ERROR, "Request failed with HTTP status " + response.getStatusCode());
                }
                future.set(response.getValue());
            }

            @Override
            public void onFailure(Throwable failedReason)
            {
                if (failedReason instanceof RejectedExecutionException) {
                    log.error(format("Unable to start the native process. Reason: %s", failedReason.getMessage()));
                    future.setException(failedReason);
                    return;
                }
                // record failure
                try {
                    errorTracker.requestFailed(failedReason);
                }
                catch (PrestoException e) {
                    future.setException(e);

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Check the native worker log/stderr (getCrashReport/abortMessage) for why the server-info endpoint returned a non-200 status.
  2. Verify native worker and coordinator versions are compatible (endpoint paths unchanged).
  3. Confirm the acquired port is actually used by the native process and not occupied by another service.
  4. If 503 during startup, increase startup timeout/retry window so the worker has time to become ready.

Example fix

// before: any non-200 is immediately fatal
if (response.getStatusCode() != SC_OK) {
    throw new PrestoException(GENERIC_INTERNAL_ERROR, "Request failed with HTTP status " + response.getStatusCode());
}
// after (caller-side): retry startup probe before giving up
if (response.getStatusCode() != SC_OK) {
    if (errorTracker.requestFailed(
            new PrestoException(GENERIC_INTERNAL_ERROR, "HTTP " + response.getStatusCode())) == null) {
        return; // retried within window
    }
    throw new PrestoException(GENERIC_INTERNAL_ERROR, "Request failed with HTTP status " + response.getStatusCode());
}
Defensive patterns

Strategy: try-catch

Validate before calling

// pre-flight: probe the native worker's server-info endpoint after startup
try (Response r = httpClient.newCall(new Request.Builder()
        .url("http://" + host + ":" + port + "/v1/info").build()).execute()) {
    if (r.code() != 200) {
        throw new IllegalStateException("Native worker /v1/info returned HTTP " + r.code());
    }
}

Type guard

public static boolean isOk(BaseResponse<?> response) {
    return response != null && response.getStatusCode() == 200;
}

Try / catch

try {
    ServerInfo info = process.waitForServerInfo().get(2, TimeUnit.MINUTES);
} catch (ExecutionException e) {
    if (e.getCause() instanceof PrestoException
            && e.getCause().getMessage().startsWith("Request failed with HTTP status")) {
        // inspect native worker logs / crash report, then retry on another node
        log.error("Native startup handshake failed: %s", process.getCrashReport());
    }
    throw e;
}

Prevention

When it happens

Trigger: serverClient.getServerInfo() completes successfully but response.getStatusCode() != 200 — the native worker returned 404, 500, 503, etc. for the server-info request during process startup.

Common situations: Native worker binary version mismatch between coordinator client and worker HTTP endpoints; worker up but overloaded/initializing and returning 503; wrong port assigned to a process (another service answering); native worker crash mid-handshake returning an error page.

Related errors


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