prestodb/presto · warning · UncheckedIOException
java.io.IOException (wrapped in UncheckedIOException)
Error message
java.io.IOException (wrapped in UncheckedIOException)
What it means
MapBatchStreamReader.close wraps IOException raised while closing its direct/flat delegate readers in UncheckedIOException. It is a cleanup-time failure: closing the child map readers (and their nested key/value streams) hit an I/O problem, typically because the underlying source was already closed or a storage error occurred.
Source
Thrown at presto-orc/src/main/java/com/facebook/presto/orc/reader/MapBatchStreamReader.java:113
}
@Override
public String toString()
{
return toStringHelper(this)
.addValue(streamDescriptor)
.toString();
}
@Override
public void close()
{
try (Closer closer = Closer.create()) {
closer.register(directReader::close);
closer.register(flatReader::close);
}
catch (IOException e) {
throw new UncheckedIOException(e);
}
}
@Override
public long getRetainedSizeInBytes()
{
return INSTANCE_SIZE + directReader.getRetainedSizeInBytes() + flatReader.getRetainedSizeInBytes();
}
}
View on GitHub (pinned to 55bb57d202)
Solutions
- Ensure the OrcDataSource outlives all readers; close readers first, source last.
- Make close() idempotent in any custom stream implementations.
- Inspect the wrapped cause — treat this as secondary to the original query failure.
- Upgrade if the unwrap reveals a known double-close issue in the ORC driver.
Example fix
// before dataSource.close(); mapReader.close(); // after mapReader.close(); dataSource.close();
Defensive patterns
Strategy: try-catch
Try / catch
try {
mapReader.close();
}
catch (UncheckedIOException e) {
LOG.warn(e.getCause(), "Failed to close map batch reader delegates");
} Prevention
- Close readers before closing the OrcDataSource.
- Use Closer.create() so all delegates still get closed even if one throws.
- Keep the datasource open until all page sources are drained or cancelled.
- Make close() idempotent in custom streams.
When it happens
Trigger: Calling close() after the OrcDataSource has already been closed elsewhere; storage-layer failure during stream teardown of key/value sub-readers.
Common situations: Query cancellation paths that close the datasource before page-source readers; double-close in custom readers; transient HDFS/S3 errors during 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/b28d67e47db79431.
Report an issue: GitHub.