prestodb/presto · warning · UncheckedIOException
java.io.IOException (wrapped in UncheckedIOException)
Error message
java.io.IOException (wrapped in UncheckedIOException)
What it means
MapDirectBatchStreamReader.close wraps IOException from closing the nested key and value stream readers in UncheckedIOException. It is a teardown-time failure indicating the underlying ORC streams could not be closed cleanly — typically because the datasource was already closed or a storage error occurred during cleanup.
Source
Thrown at presto-orc/src/main/java/com/facebook/presto/orc/reader/MapDirectBatchStreamReader.java:285
}
@Override
public String toString()
{
return toStringHelper(this)
.addValue(streamDescriptor)
.toString();
}
@Override
public void close()
{
try (Closer closer = Closer.create()) {
closer.register(keyStreamReader::close);
closer.register(valueStreamReader::close);
}
catch (IOException e) {
throw new UncheckedIOException(e);
}
}
@Override
public long getRetainedSizeInBytes()
{
return INSTANCE_SIZE + keyStreamReader.getRetainedSizeInBytes() + valueStreamReader.getRetainedSizeInBytes();
}
}
View on GitHub (pinned to 55bb57d202)
Solutions
- Close readers before the OrcDataSource; use a Closer to enforce ordering.
- Ensure close() is idempotent in custom streams.
- Inspect the wrapped IOException cause; treat as secondary to the original query failure.
- Upgrade Presto if this matches a known double-close bug.
Example fix
// before
dataSource.close();
mapReader.close();
// after
try (Closer closer = Closer.create()) {
closer.register(mapReader::close);
closer.register(dataSource::close);
} Defensive patterns
Strategy: try-catch
Try / catch
try {
mapReader.close();
}
catch (UncheckedIOException e) {
LOG.warn(e.getCause(), "Failed closing map key/value stream readers");
} Prevention
- Establish close order: readers, then datasource.
- Use Closer so key and value readers both close even on failure.
- Never close the shared OrcDataSource while readers are active.
- Make custom streams tolerate repeated close().
When it happens
Trigger: Calling close() on the map reader after the OrcDataSource was closed; disk/network errors while closing the key or value column streams.
Common situations: Query cancellation closing the source before readers; double-close paths in custom page-source code; transient storage failures (HDFS/S3) at teardown.
Related errors
- java.io.IOException (wrapped in UncheckedIOException)
- java.io.IOException (wrapped in UncheckedIOException)
- java.io.IOException (wrapped in UncheckedIOException)
- java.io.IOException (wrapped in UncheckedIOException)
- java.io.IOException (wrapped in UncheckedIOException)
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/a0d372e9c0120902.
Report an issue: GitHub.