You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have a java project that uses VW, and we love it! However, when the java code runs in an Ubuntu 14.04 docker container, it can't load the native bindings. I figured out why this happens and will propose a solution at the bottom of this issue description.
The Error: The following traceback occurs when we run our java program inside a docker container that inherits from Ubuntu:14.04.
[info] java.lang.UnsatisfiedLinkError: no vw_jni in java.library.path
[info] at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1864)
[info] at java.lang.Runtime.loadLibrary0(Runtime.java:870)
[info] at java.lang.System.loadLibrary(System.java:1122)
[info] at vw.jni.NativeUtils.loadOSDependentLibrary(NativeUtils.java:116)
[info] at vw.learner.VWLearners.loadNativeLibrary(VWLearners.java:85)
[info] at vw.learner.VWLearners.initializeVWJni(VWLearners.java:73)
[info] at vw.learner.VWLearners.create(VWLearners.java:44)
Why this happens:
Looking at VW source code for java/src/main/java/vw/jni/NativeUtils.java, a function named getDistroName directly queries /proc/version (see source). In docker, this returns the host's kernel version, which may not be Ubuntu. (If you use docker-machine, /proc/version returns information about the docker-machine VM that the container runs in). What we actually want it to do, as far as I understand, is query the container OS version, which is Ubuntu 14.04.
Possible Solution:
For better compatibility with VW in docker containers, I suggest we don't query /proc/version. What if, instead, we replace the linux-specific contents of getDistroName with lsb_release -i? Since we already use lsb_release -r for getLinuxVersion, this seems to make quite a bit of sense to me, and I believe it will work in a docker container.
I'd love to get your feedback and would be happy to submit a PR if necessary.
The text was updated successfully, but these errors were encountered:
This has been a persistent issue, so it would be nice to get it solved. @jmorra@deaktator have been the primary ones working on the java interface, but if you want to work on a patch for them, that may work well.
I'm fine with changing this as long as it continues to work on Mac and builds with build.sh I have no problem with any change. @adgaudio is this something you can work on?
Hi,
We have a java project that uses VW, and we love it! However, when the java code runs in an Ubuntu 14.04 docker container, it can't load the native bindings. I figured out why this happens and will propose a solution at the bottom of this issue description.
The Error: The following traceback occurs when we run our java program inside a docker container that inherits from Ubuntu:14.04.
Why this happens:
Looking at VW source code for
java/src/main/java/vw/jni/NativeUtils.java
, a function namedgetDistroName
directly queries/proc/version
(see source). In docker, this returns the host's kernel version, which may not be Ubuntu. (If you use docker-machine, /proc/version returns information about the docker-machine VM that the container runs in). What we actually want it to do, as far as I understand, is query the container OS version, which is Ubuntu 14.04.Possible Solution:
For better compatibility with VW in docker containers, I suggest we don't query /proc/version. What if, instead, we replace the linux-specific contents of
getDistroName
withlsb_release -i
? Since we already uselsb_release -r
forgetLinuxVersion
, this seems to make quite a bit of sense to me, and I believe it will work in a docker container.I'd love to get your feedback and would be happy to submit a PR if necessary.
The text was updated successfully, but these errors were encountered: