apache/druid · error · UncheckedIOException
Unable to close channel for name :
Error message
Unable to close channel for name :
What it means
During SuperSorter cleanup, each partitioned output channel's readable channel supplier is closed; if close() throws an IOException it is rethrown as UncheckedIOException with the channel name. This means a frame file backing one of the sorter's output channels could not be released, typically pointing at filesystem problems rather than sorter logic. Cleanup aborts with the offending channel named in the message.
Source
Thrown at processing/src/main/java/org/apache/druid/frame/processor/SuperSorter.java:1006
{
if (!isAllDone() || activeProcessors != 0) {
// This condition indicates a logic bug.
throw new ISE("Improper cleanup");
}
if (log.isDebugEnabled()) {
log.debug(stateString());
}
outputsReadyByLevel.clear();
inputBuffer.clear();
for (Map.Entry<String, PartitionedOutputChannel> cleanupEntry :
levelAndRankToReadableChannelMap.entrySet()) {
try {
cleanupEntry.getValue().getReadableChannelSupplier().get().close();
}
catch (IOException e) {
throw new UncheckedIOException("Unable to close channel for name : " + cleanupEntry.getKey(), e);
}
}
levelAndRankToReadableChannelMap.clear();
if (!inputChannelsToRead.isEmpty()) {
for (final ReadableFrameChannel inputChannel : inputChannels) {
CloseableUtils.closeAndSuppressExceptions(
inputChannel::close,
e -> log.warn(e, "Could not close input channel")
);
}
inputChannels.forEach(ReadableFrameChannel::close);
}
inputChannelsToRead.clear();
}
View on GitHub (pinned to 9b90983fd2)
Solutions
- Check the druid interim/temp storage directory for free space, permissions, and that the backing file still exists.
- Look for external cleanup jobs (tmpwatch, k8s emptyDir eviction) that might delete spill files mid-query and exclude that directory.
- Inspect the underlying IOException cause in the stack trace — 'No such file' vs 'No space left' lead to different fixes.
- If only cleanup fails after results were produced, treat it as a resource leak warning but investigate disk hygiene; the query output may still be valid.
Defensive patterns
Strategy: try-catch
Validate before calling
// Verify interim storage is writable and has space before query execution Files.isDirectory(interimPath) && Files.isWritable(interimPath)
Try / catch
try {
sorter.cleanUp();
} catch (UncheckedIOException e) {
log.warn(e, "Failed to close sorter channel: %s", e.getMessage());
// query output may still be valid; surface as resource-leak warning
} Prevention
- Monitor disk space and mount state of the interim spill directory.
- Exclude druid interim paths from external tmp-cleaning jobs.
- Keep consistent permissions on the frame-file directory across worker restarts.
When it happens
Trigger: Closing a ReadableFrameChannel whose backing file was deleted, is on a full/unmounted filesystem, or whose file handle is in a bad state; occurs in cleanUp()'s loop over levelAndRankToReadableChannelMap when getReadableChannelSupplier().get().close() fails.
Common situations: Disks full or remounted read-only during query execution; interim files cleaned by an external process (e.g., tmp cleaner) before the sorter finished; permission changes on the druid intermediate spill directory.
Related errors
- Cannot list directory [%s]
- Could not close channel for level [%d] and rank [%d]
- Path [%s] is not writable, check permissions
- Failed to create temporary directory in path [%s]
- Cannot create directory [%s]
AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07).
Data as JSON: /api/errors/14217fa66a3eb6f9.
Report an issue: GitHub.