sjwiesman opened a new pull request #13445:
URL: https://github.com/apache/flink/pull/13445
## What is the purpose of the change
State processor api uses AbstractStateBackend#getKeys and
AbstractStateBackend#getKeysAndNamespaces to iterate over keys and namespaces
in a savepoint. These methods return java.util.stream.Stream. The
RocksDBKeyedStateBackend implemention of these methods use streams onClose
callback to free native resources.
However, spa eagerly turns this stream into an iterator. This causes the
onClose method to be discarded leading to a native resource leak. This can lead
to a segmentation fault when multiple spa jobs are submitted to the same
session cluster.
## Brief change log
Update KeyedStateInputFormat to actively close these streams.
## Verifying this change
Manually verified that submitting multiple jobs concurrently which use
RocksDB no longer leads to a seg fault.
## Does this pull request potentially affect one of the following parts:
- Dependencies (does it add or upgrade a dependency): (yes / **no**)
- The public API, i.e., is any changed class annotated with
`@Public(Evolving)`: (yes / **no**)
- The serializers: (yes / no / don't know)
- The runtime per-record code paths (performance sensitive): (yes / **no**
/ don't know)
- Anything that affects deployment or recovery: JobManager (and its
components), Checkpointing, Kubernetes/Yarn/Mesos, ZooKeeper: (yes / **no** /
don't know)
- The S3 file system connector: (yes / **no** / don't know)
## Documentation
- Does this pull request introduce a new feature? (yes / **no**)
- If yes, how is the feature documented? (not applicable / docs / JavaDocs
/ **not documented**)
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]