{"record":{"id":"2e3a47f2ee771e54","repo":"apache/druid","slug":"error-closing-org-apache-druid-query-aggregation-s","errorCode":null,"errorMessage":"error closing org.apache.druid.query.aggregation.SerializablePairLongDoubleComplexColumn","messagePattern":"error closing org\\.apache\\.druid\\.query\\.aggregation\\.SerializablePairLongDoubleComplexColumn","errorType":"exception","errorClass":"ResponseException","httpStatus":null,"severity":"error","filePath":"processing/src/main/java/org/apache/druid/query/aggregation/SerializablePairLongDoubleComplexColumn.java","lineNumber":86,"sourceCode":"  public Object getRowValue(int rowNum)\n  {\n    return serde.deserialize(cellReader.getCell(rowNum));\n  }\n\n  @Override\n  public int getLength()\n  {\n    return serializedSize;\n  }\n\n  @Override\n  public void close()\n  {\n    try {\n      closer.close();\n    }\n    catch (IOException e) {\n      throw new RE(e, \"error closing \" + getClass().getName());\n    }\n  }\n\n  public static class Builder\n  {\n    private final int serializedSize;\n    private final AbstractSerializablePairLongObjectDeltaEncodedStagedSerde<?> serde;\n    private final CellReader.Builder cellReaderBuilder;\n\n    public Builder(ByteBuffer buffer)\n    {\n      ByteBuffer masterByteBuffer = buffer.asReadOnlyBuffer().order(ByteOrder.nativeOrder());\n\n      serializedSize = masterByteBuffer.remaining();\n\n      AbstractSerializablePairLongObjectColumnHeader<?> columnHeader =\n          AbstractSerializablePairLongObjectColumnHeader.fromBuffer(masterByteBuffer, SerializablePairLongDouble.class);\n","sourceCodeStart":68,"sourceCodeEnd":104,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/processing/src/main/java/org/apache/druid/query/aggregation/SerializablePairLongDoubleComplexColumn.java#L68-L104","documentation":"SerializablePairLongDoubleComplexColumn.close() releases resources via a Closer. If closer.close() throws an IOException (e.g., while closing an underlying channel or file), it is wrapped in a Druid RE with the message 'error closing <class name>'. This signals a resource leak or I/O problem during cleanup of a serialized pair-long-double complex column.","triggerScenarios":"Calling close() when the underlying Closeable held by the Closer fails to close — e.g., an IOException from closing the memory-mapped file or channel backing the serialized column.","commonSituations":"Underlying segment files already closed or deleted before the column; filesystem issues (NFS staleness, permission changes); double-close bugs where the channel was closed elsewhere and close() surfaces a retry failure; shutdown ordering issues in query/segment cleanup.","solutions":["Check that the underlying file/channel is not closed or deleted elsewhere before this column's close() runs","Inspect the wrapped IOException (getCause()) for the real close failure and fix the underlying I/O issue","Ensure the column is closed exactly once via the Closer/Try-style lifecycle (avoid manual close on top of a registered closer)","Verify disk/filesystem health and permissions for the segment directory"],"exampleFix":"// before\ncloser.close(); // IOException propagates as RE\n// after\ntry {\n  closer.close();\n} catch (IOException e) {\n  LOG.warn(e, \"error closing %s\", getClass().getName()); // tolerate close failures during cleanup\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  column.close();\n} catch (RE e) {\n  if (e.getCause() instanceof IOException) {\n    LOG.warn(e, \"failed to close SerializablePairLongDoubleComplexColumn; possible leaked resource\");\n  } else {\n    throw e;\n  }\n}","preventionTips":["Let the Closer own the underlying resources — never close the channel/file manually as well","Close columns before deleting or unmapping their backing segment files","Monitor for IOException causes indicating already-closed channels (double-close) or missing files","Run query cleanup on stable local storage; avoid force-terminating tasks mid-cleanup"],"tags":["java","io","resource-cleanup"],"backgroundTag":"file-close-failed","analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}