{"record":{"id":"510a79a520df4a58","repo":"aeron-io/aeron","slug":"insufficient-usable-storage-for-new-log-of-length-loglength","errorCode":null,"errorMessage":"insufficient usable storage for new log of length=<logLength> usable=<usableSpace> in <fileStore>","messagePattern":"insufficient usable storage for new log of length=<logLength> usable=<usableSpace> in <fileStore>","errorType":"exception","errorClass":"StorageSpaceException","httpStatus":null,"severity":"critical","filePath":"aeron-driver/src/main/java/io/aeron/driver/buffer/FileStoreLogFactory.java","lineNumber":149,"sourceCode":"    {\n        final long logLength = computeLogLength(termLength, filePageSize);\n        checkStorage(logLength);\n\n        final File location = streamLocation(rootDir, correlationId);\n\n        return new MappedRawLog(\n            location, useSparseFiles, logLength, termLength, filePageSize, errorHandler, mappedBytesCounter);\n    }\n\n    private void checkStorage(final long logLength)\n    {\n        if (checkStorage)\n        {\n            final long usableSpace = getUsableSpace();\n\n            if (usableSpace < logLength)\n            {\n                throw new StorageSpaceException(\n                    \"insufficient usable storage for new log of length=\" + logLength + \" usable=\" + usableSpace +\n                    \" in \" + fileStore);\n            }\n\n            if (usableSpace <= lowStorageWarningThreshold)\n            {\n                final String msg =\n                    \"space is running low: threshold=\" + lowStorageWarningThreshold +\n                    \" usable=\" + usableSpace + \" in \" + fileStore;\n\n                errorHandler.onError(new AeronException(msg, AeronException.Category.WARN));\n            }\n        }\n    }\n\n    private long getUsableSpace()\n    {\n        long usableSpace = 0;","sourceCodeStart":131,"sourceCodeEnd":167,"githubUrl":"https://github.com/aeron-io/aeron/blob/6d60124e15e35c11b49ba2e3c2c2858a09a18803/aeron-driver/src/main/java/io/aeron/driver/buffer/FileStoreLogFactory.java#L131-L167","documentation":"FileStoreLogFactory.checkStorage runs before every new publication/image log buffer allocation and throws io.aeron.exceptions.StorageSpaceException when the usable space on the data directory's file store is less than the total log length (3 * termLength padded to filePageSize). This guards against allocating large term buffers on a full disk. When usable space falls to or below the low-storage threshold, only a warning is issued, but below logLength is a hard failure.","triggerScenarios":"newPublication() or newImage() (via newInstance) is called while usableSpace < logLength: typically creating a publication/image with large termLength (e.g. 1GB terms need ~3GB) on a nearly full filesystem, with aeron.driver.storage.check enabled (default).","commonSituations":"Disk filled by log buffers that were never deleted (unclosed publications), default 16MB terms on a small disk/container volume, many concurrent streams exhausting space, or Docker overlay volume limits hit.","solutions":["Free space on the filesystem backing aeron.data.dir (delete old publications/images directories while the driver is stopped, or clean other files).","Reduce aeron.term.buffer.length (and aeron.ipc.term.buffer.length) or set aeron.publication.unblock/expire streams so buffers are reclaimed.","Enable aeron.term.buffer.sparse.file=true to allocate sparse files that consume less real space.","Disable the check with aeron.driver.storage.check=false only if you can monitor space yourself; the subsequent file creation will fail anyway if the disk is truly full.","Move aeron.data.dir to a larger volume."],"exampleFix":"// before\nMediaDriver.Context ctx = new MediaDriver.Context()\n    .termBufferLength(1 << 30); // 1GB terms -> ~3GB per log\n// after\nMediaDriver.Context ctx = new MediaDriver.Context()\n    .termBufferLength(1 << 20)   // 1MB terms -> ~3MB per log\n    .termBufferSparseFile(true);","handlingStrategy":"validation","validationCode":"import java.io.File;\nimport java.nio.file.Files;\nvoid ensureSpace(String dataDir, long requiredBytes) throws Exception {\n    long usable = Files.getFileStore(new File(dataDir).toPath()).getUsableSpace();\n    if (usable < requiredBytes) {\n        throw new IllegalStateException(\"need \" + requiredBytes + \" bytes, only \" + usable + \" usable\");\n    }\n}\n// requiredBytes = 3L * termBufferLength rounded up to filePageSize","typeGuard":null,"tryCatchPattern":"try {\n    publication = aeron.addPublication(channel, streamId);\n} catch (io.aeron.exceptions.StorageSpaceException e) {\n    // free disk or reduce term length, then retry\n    log.error(\"insufficient storage: \" + e.getMessage());\n}","preventionTips":["Monitor usable space on aeron.data.dir against the low-storage warning threshold.","Size term buffers to fit concurrent streams within available disk (3 * termLength per stream).","Use sparse term files (aeron.term.buffer.sparse.file=true).","Alert on disk usage before it reaches the threshold; clean publications/images dirs while the driver is stopped."],"tags":["java","disk-full","storage","storage-space-exception"],"backgroundTag":"file-size-limit-exceeded","analyzedSha":"6d60124e15e35c11b49ba2e3c2c2858a09a18803","analyzedAt":"2026-09-12T11:17:07.683Z","contentChangedAt":"2026-09-12T11:17:07.683Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}