prestodb/presto · critical · UncheckedIOException

Error creating temporary directory 'local_shuffle'.

Error message

Error creating temporary directory 'local_shuffle'.

What it means

PrestoSparkLocalShuffleInfoTranslator's constructor creates a base temporary directory named 'local_shuffle' via Files.createTempDirectory for local shuffle staging. If the filesystem refuses the directory creation (IOException), it throws UncheckedIOException with the message "Error creating temporary directory 'local_shuffle'." because local shuffle cannot function without it.

Source

Thrown at presto-spark-base/src/main/java/com/facebook/presto/spark/execution/shuffle/PrestoSparkLocalShuffleInfoTranslator.java:44

import static java.util.Objects.requireNonNull;

public class PrestoSparkLocalShuffleInfoTranslator
        implements PrestoSparkShuffleInfoTranslator
{
    private final String localShuffleRootPath;
    private final JsonCodec<PrestoSparkLocalShuffleReadInfo> readInfoJsonCodec;
    private final JsonCodec<PrestoSparkLocalShuffleWriteInfo> writeInfoJsonCodec;

    @Inject
    public PrestoSparkLocalShuffleInfoTranslator(
            JsonCodec<PrestoSparkLocalShuffleReadInfo> readInfoJsonCodec,
            JsonCodec<PrestoSparkLocalShuffleWriteInfo> writeInfoJsonCodec)
    {
        try {
            this.localShuffleRootPath = Files.createTempDirectory("local_shuffle").toAbsolutePath().toString();
        }
        catch (IOException e) {
            throw new UncheckedIOException("Error creating temporary directory 'local_shuffle'.", e);
        }
        this.readInfoJsonCodec = requireNonNull(readInfoJsonCodec, "readInfoJsonCodec is null");
        this.writeInfoJsonCodec = requireNonNull(writeInfoJsonCodec, "writeInfoJsonCodec is null");
    }

    @Override
    public PrestoSparkLocalShuffleWriteInfo createShuffleWriteInfo(Session session, PrestoSparkShuffleWriteDescriptor writeDescriptor)
    {
        // TODO: Determine sortedShuffle from PartitionAndSerializeNode plan metadata (sortingOrders/sortingKeys).
        // Requires extending PrestoSparkShuffleWriteDescriptor or maintaining shuffleId->sortedShuffle mapping.
        boolean sortedShuffle = false;
        return new PrestoSparkLocalShuffleWriteInfo(writeDescriptor.getNumPartitions(), session.getQueryId().getId(), writeDescriptor.getShuffleHandle().shuffleId(), localShuffleRootPath, sortedShuffle);
    }

    @Override
    public PrestoSparkLocalShuffleReadInfo createShuffleReadInfo(Session session, PrestoSparkShuffleReadDescriptor readDescriptor)
    {
        // TODO: Determine sortedShuffle from write-side metadata or shuffle descriptor.

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Ensure java.io.tmpdir points to a writable directory with sufficient space for the Spark process
  2. Free disk space on the temp volume or increase container tmpfs size
  3. Check filesystem permissions/ownership for the user running Spark executors
  4. If the OS restricts temp dirs (e.g., read-only container FS), set java.io.tmpdir to a writable mounted path

Example fix

// before
spark.executor.extraJavaOptions=  # default tmpdir unwritable
// after
spark.executor.extraJavaOptions=-Djava.io.tmpdir=/mnt/writable/spark-tmp
Defensive patterns

Strategy: validation

Validate before calling

Path tmp = Paths.get(System.getProperty("java.io.tmpdir"));
if (!Files.isDirectory(tmp) || !Files.isWritable(tmp)) {
    throw new IllegalStateException("Temp dir not writable: " + tmp);
}

Try / catch

try {
    translator = new PrestoSparkLocalShuffleInfoTranslator(readCodec, writeCodec);
} catch (UncheckedIOException e) {
    // Inspect e.getCause() (IOException) for disk full / permission denied
}

Prevention

When it happens

Trigger: Constructing PrestoSparkLocalShuffleInfoTranslator calls Files.createTempDirectory("local_shuffle") against the default temp-dir filesystem; any IOException (no permission, no space, read-only FS, non-existent java.io.tmpdir) surfaces as this UncheckedIOException at PrestoSparkLocalShuffleInfoTranslator.java:44.

Common situations: Executors running with a read-only root filesystem or no writable java.io.tmpdir, disk full on the temp volume, restrictive umask/permissions for the Spark process user, or containers with tiny tmpfs.

Related errors


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