shuwenwei commented on PR #18999: URL: https://github.com/apache/iotdb/pull/18999#issuecomment-6406549384
### `DiskAlignedChunkLoader` may double-close chunks on failure At `DiskAlignedChunkLoader.getChunkReader()` (around L127-L147), the catch block closes `timeChunk` and every chunk in `valueChunkList`. However, in TsFile 2.5.1: - `AlignedChunkReader` / `TableChunkReader` already closes its chunks if `initAllPageReaders()` fails. - `QueryChunkReaders.retain()` also closes the reader before throwing when the query resource registry is already closed. Therefore failures in either `new AlignedChunkReader(...)` / `new TableChunkReader(...)` or `QueryChunkReaders.retain(...)` can execute `Chunk.close()` twice. `Chunk.close()` releases a page-AEAD `EncryptParameter` reference and is not idempotent, so this can over-release the file-level context and destroy the provider context too early. Suggested fix: track whether ownership has been transferred to the `IChunkReader`/`QueryChunkReaders`; only close the raw chunks when the reader was not successfully constructed or ownership was not transferred. Otherwise let `IChunkReader.close()` perform the cleanup once. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
