prestodb/presto · error · UncheckedIOException

java.io.IOException (wrapped in UncheckedIOException)

Error message

java.io.IOException (wrapped in UncheckedIOException)

What it means

LongBatchStreamReader.close registers directReader::close and dictionaryReader::close with a Closer; any IOException thrown while closing the underlying ORC data streams is wrapped in an UncheckedIOException. This means a low-level I/O failure (disk error, already-closed channel, network filesystem issue) occurred during resource cleanup.

Source

Thrown at presto-orc/src/main/java/com/facebook/presto/orc/reader/LongBatchStreamReader.java:122

    }

    @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(dictionaryReader::close);
        }
        catch (IOException e) {
            throw new UncheckedIOException(e);
        }
    }

    @Override
    public long getRetainedSizeInBytes()
    {
        return INSTANCE_SIZE + directReader.getRetainedSizeInBytes() + dictionaryReader.getRetainedSizeInBytes();
    }
}

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Inspect the cause via UncheckedIOException.getCause() to find the real IOException and its data source id
  2. Retry the query if transient (HDFS/network flake); check NameNode/datanode and S3 endpoint health
  3. Ensure the OrcDataSource implementation is safe to close once and is not closed concurrently elsewhere
  4. Upgrade to a Presto version where close failures during cleanup are logged instead of propagated
Defensive patterns

Strategy: try-catch

Try / catch

try { ... } catch (UncheckedIOException e) { log.warn("ORC reader close failed", e.getCause()); /* transient: retry query */ }

Prevention

When it happens

Trigger: close() is invoked (end of stripe/operator lifetime) and one of the inner streams' close throws IOException, e.g. releasing an encrypted/HDFS file handle that fails.

Common situations: HDFS/S3 connectivity drops while releasing readers; double-close bugs in custom data sources; intermittent NFS issues during query teardown.

Related errors


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