prestodb/presto · error · UncheckedIOException

java.io.IOException (wrapped in UncheckedIOException)

Error message

java.io.IOException (wrapped in UncheckedIOException)

What it means

MapFlatBatchStreamReader.close() closes all value stream readers inside a try-with-resources Closer. Any underlying IOException is wrapped in UncheckedIOException so the AutoCloseable contract can be honored without checked exceptions. It signals an I/O failure while releasing ORC stream resources.

Source

Thrown at presto-orc/src/main/java/com/facebook/presto/orc/reader/MapFlatBatchStreamReader.java:379

    @Override
    public String toString()
    {
        return toStringHelper(this)
                .addValue(streamDescriptor)
                .toString();
    }

    @Override
    public void close()
    {
        try (Closer closer = Closer.create()) {
            for (BatchStreamReader valueStreamReader : valueStreamReaders) {
                closer.register(valueStreamReader::close);
            }
        }
        catch (IOException e) {
            throw new UncheckedIOException(e);
        }
    }

    @Override
    public long getRetainedSizeInBytes()
    {
        long retainedSize = INSTANCE_SIZE;

        for (BatchStreamReader valueStreamReader : valueStreamReaders) {
            retainedSize += valueStreamReader.getRetainedSizeInBytes();
        }

        return retainedSize;
    }
}

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Inspect the cause via getCause() (the original IOException)
  2. Ensure the OrcDataSource is healthy and not already closed before reading
  3. Wrap reader teardown in try/finally and log rather than crash on close failures
  4. Check network/storage connectivity to the underlying file source

Example fix

// before
reader.close();
// after
try { reader.close(); } catch (UncheckedIOException e) { log.warn(e.getCause(), "ORC reader close failed"); }
Defensive patterns

Strategy: try-catch

Validate before calling

null

Type guard

null

Try / catch

try (OrcBatchStreamReader reader = loader.createBatchReader(...)) { ... } catch (UncheckedIOException e) { log.warn(e.getCause(), "Failed to close ORC reader"); }

Prevention

When it happens

Trigger: Calling close() on MapFlatBatchStreamReader (directly or via OrcBatchStreamReader/reader teardown) when an underlying stream read/close fails, e.g. a closed or broken IO source.

Common situations: Closing readers after HDFS/S3 read failures; closing an already-failed read pipeline; double-close on a broken datasource.

Related errors


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