[
https://issues.apache.org/jira/browse/FLINK-5408?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15799697#comment-15799697
]
ASF GitHub Bot commented on FLINK-5408:
---------------------------------------
GitHub user StephanEwen opened a pull request:
https://github.com/apache/flink/pull/3060
[FLINK-5408] [RocksDB backend] Uniquify RocksDB JNI library path to avoid
multiple classloader problem
When the RocksDB is loaded from different ClassLoaders (for example because
it is in the user code jar, or loaded dynamically in tests) it may fail with an
```
java.lang.UnsatisfiedLinkError: Native Library
/path/to/temp/dir/librocksdbjni-linux64.so already loaded in another
classloader.
```
Apparently the JVM can handle multiple instances of the same JNI library
being loaded in different class loaders, but not when coming from the same file
path.
This makes sure the JNI lib path is unique to circumvent this.
The test reflectively loads different versions of the class from different
class loaders to validate that.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/StephanEwen/incubator-flink rdb_loading
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/flink/pull/3060.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #3060
----
commit d5256a2e89004c436bc7943affaec16b91cdb56a
Author: Stephan Ewen <[email protected]>
Date: 2017-01-04T23:18:13Z
[FLINK-5408] [RocksDB backend] Uniquify RocksDB JNI library path to avoid
multiple classloader problem
----
> RocksDB initialization can fail with an UnsatisfiedLinkError in the presence
> of multiple classloaders
> -----------------------------------------------------------------------------------------------------
>
> Key: FLINK-5408
> URL: https://issues.apache.org/jira/browse/FLINK-5408
> Project: Flink
> Issue Type: Bug
> Components: ksDB State Backend
> Affects Versions: 1.2.0
> Reporter: Stephan Ewen
> Assignee: Stephan Ewen
> Fix For: 1.2.0, 1.3.0
>
>
> When the RocksDB is loaded from different ClassLoaders (for example because
> it is in the user code jar, or loaded dynamically in tests) it may fail with
> an {{"java.lang.UnsatisfiedLinkError: Native Library
> /path/to/temp/dir/librocksdbjni-linux64.so already loaded in another
> classloader}}.
> Apparently the JVM can handle multiple instances of the same JNI library
> being loaded in different class loaders, but not when coming from the same
> file path.
> This affects only version 1.2 onward, because from there we extract the JNI
> library into Flink's temp folders to make sure that it gets cleaned up for
> example by YARN when the application finishes. When giving a parent
> directory, RocksDB does not add a unique number sequence to the temp file
> name.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)