prestodb/presto · warning · ArrowException
ARROW_FLIGHT_METADATA_ERROR
ARROW_FLIGHT_METADATA_ERROR
Error message
Error getting schema for flight:
What it means
getSchema performs FlightClient.getSchema(descriptor, callOptions) to retrieve an Arrow schema for a descriptor. An InterruptedException during the RPC is wrapped as ArrowException(ARROW_FLIGHT_METADATA_ERROR) with 'Error getting schema for flight: <msg>'. As with getFlightInfo, the interrupt flag is not restored before throwing.
Source
Thrown at presto-base-arrow-flight/src/main/java/com/facebook/plugin/arrow/BaseArrowFlightClientHandler.java:168
.map(this::createFlightClient)
.orElseGet(this::createFlightClient);
return new ClientClosingFlightStream(
client.getStream(endpoint.getTicket(), getCallOptions(connectorSession)),
client);
}
catch (FlightRuntimeException | IOException | URISyntaxException e) {
throw new ArrowException(ARROW_FLIGHT_CLIENT_ERROR, e.getMessage(), e);
}
}
public Schema getSchema(ConnectorSession connectorSession, FlightDescriptor flightDescriptor)
{
try (FlightClient client = createFlightClient()) {
CallOption[] callOptions = this.getCallOptions(connectorSession);
return client.getSchema(flightDescriptor, callOptions).getSchema();
}
catch (InterruptedException e) {
throw new ArrowException(ARROW_FLIGHT_METADATA_ERROR, "Error getting schema for flight: " + e.getMessage(), e);
}
}
public abstract List<String> listSchemaNames(ConnectorSession session);
public abstract List<SchemaTableName> listTables(ConnectorSession session, Optional<String> schemaName);
protected abstract FlightDescriptor getFlightDescriptorForSchema(ConnectorSession session, String schemaName, String tableName);
protected abstract FlightDescriptor getFlightDescriptorForTableScan(ConnectorSession session, ArrowTableLayoutHandle tableLayoutHandle);
public Schema getSchemaForTable(ConnectorSession connectorSession, String schemaName, String tableName)
{
FlightDescriptor flightDescriptor = getFlightDescriptorForSchema(connectorSession, schemaName, tableName);
return getSchema(connectorSession, flightDescriptor);
}
public FlightInfo getFlightInfoForTableScan(ConnectorSession session, ArrowTableLayoutHandle tableLayoutHandle)View on GitHub (pinned to 55bb57d202)
Solutions
- Rerun the metadata operation if interruption was from an intentional cancel.
- Drain workers before restarts/deployments to avoid mid-RPC interrupts.
- Check for overly aggressive cancellation/timeout settings in the deployment.
- Restore the interrupt flag in custom subclasses to preserve cancellation semantics.
- Ensure the Flight RPC completes quickly (server responsiveness) so the interruption window is small.
Example fix
// before
catch (InterruptedException e) {
throw new ArrowException(ARROW_FLIGHT_METADATA_ERROR, "Error getting schema for flight: " + e.getMessage(), e);
}
// after
catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new ArrowException(ARROW_FLIGHT_METADATA_ERROR, "Error getting schema for flight: " + e.getMessage(), e);
} Defensive patterns
Strategy: retry
Validate before calling
// Skip the RPC if the current thread is already interrupted
if (Thread.currentThread().isInterrupted()) {
throw new IllegalStateException("Thread already interrupted; not calling getSchema");
} Try / catch
try {
return handler.getSchema(session, descriptor);
} catch (ArrowException e) {
if (e.getErrorCode().getCode() == ARROW_FLIGHT_METADATA_ERROR.getCode()
&& e.getCause() instanceof InterruptedException) {
// only retry if interruption was spurious; otherwise honor cancellation
}
throw e;
} Prevention
- Avoid blocking metadata resolution behind long-running operations that can be interrupted.
- Drain workers before shutdown; avoid killing threads mid-RPC.
- Cache schemas to reduce RPC frequency and interruption exposure.
- Restore the interrupt flag when wrapping InterruptedException in custom handlers.
When it happens
Trigger: Calling getSchema (via getSchemaForTable, used by getColumnsList/listTableColumns) while the thread is interrupted — query cancellation, worker shutdown, or executor teardown during the schema RPC.
Common situations: SHOW COLUMNS / metadata resolution cancelled mid-query; Presto worker being decommissioned; system-level thread interrupts from overloaded schedulers.
Related errors
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/f11965c7d65d0dac.
Report an issue: GitHub.