leekeiabstraction opened a new pull request, #28251:
URL: https://github.com/apache/flink/pull/28251
## What is the purpose of the change
Fixes a native memory leak in the RocksDB SST merge `Compactor`.
`ColumnFamilyHandle.getDescriptor()` copies the column family's options across
JNI and returns a fresh native `ColumnFamilyOptions` on every call.
`Compactor.compact()` read `numLevels()` from it but never closed it, so the
native object leaked on every compaction. Because the leaked options retain a
reference to the shared block cache (via `BlockBasedTableFactory` ->
`BlockBasedTableOptions` -> `LRUCache`), the cache's `shared_ptr` is never
released, preventing the block cache from being freed even after all tasks
stop. This causes task manager RSS to grow and eventually OOM.
## Brief change log
- Wrap `cfName.getDescriptor().getOptions()` in a try-with-resources block
in `Compactor.compact()` so the native `ColumnFamilyOptions` is closed after
`numLevels()` is read.
## Verifying this change
This change is a trivial resource-cleanup fix and is covered by existing
tests. The behavior (output level computation) is unchanged; only the
previously-leaked native handle is now closed.
## Does this pull request potentially affect one of the following parts:
- Dependencies (does it add or upgrade a dependency): no
- The public API, i.e., is any changed class annotated with
`@Public(Evolving)`: no
- The serializers: no
- The runtime per-record code paths (performance sensitive): no
- Anything that affects deployment or recovery: no
- The S3 file system connector: no
## Documentation
- Does this pull request introduce a new feature? no
- If yes, how is the feature documented? not applicable
--
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]