Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NotImplementedError: kill unsupported or native support failed to load - works on RHEL5, fails RHEL7 #4458

Closed
kimptoc opened this issue Jan 25, 2017 · 6 comments

Comments

@kimptoc
Copy link

kimptoc commented Jan 25, 2017

RHEL 5

$ java -jar /appl/lib/jruby-complete-1.7.26.jar -e "x=Process.spawn 'sleep 70000';Process.kill 'KILL',x"
$ uname -a
Linux cdcs470546.eu.rabonet.com 2.6.18-411.el5 #1 SMP Thu Jun 2 02:56:21 EDT 2016 x86_64 x86_64 x86_64 GNU/Linux
$ cat /etc/redhat-release
Red Hat Enterprise Linux Server release 5.11 (Tikanga)

RHEL 7 (with jruby.native.verbose enabled)

Failed to load native POSIX impl; falling back on Java impl. Stacktrace follows.
java.lang.UnsatisfiedLinkError: could not load FFI provider jnr.ffi.provider.jffi.Provider
	at jnr.ffi.provider.InvalidProvider$1.loadLibrary(InvalidProvider.java:48)
	at jnr.ffi.LibraryLoader.load(LibraryLoader.java:290)
	at jnr.ffi.Library.loadLibrary(Library.java:127)
	at jnr.posix.POSIXFactory$DefaultLibCProvider$SingletonHolder.<clinit>(POSIXFactory.java:279)
	at jnr.posix.POSIXFactory$DefaultLibCProvider.getLibC(POSIXFactory.java:283)
	at jnr.posix.BaseNativePOSIX.<init>(BaseNativePOSIX.java:36)
	at jnr.posix.LinuxPOSIX.<init>(LinuxPOSIX.java:18)
	at jnr.posix.POSIXFactory.loadLinuxPOSIX(POSIXFactory.java:143)
...
Caused by: java.lang.IllegalStateException: Can't overwrite cause with java.lang.UnsatisfiedLinkError: java.lang.UnsatisfiedLinkError: /tmp/jffi4609635255293149753.so: /tmp/jffi4609635255293149753.so: failed to map segment from shared object: Operation not permitted
	at java.lang.ClassLoader$NativeLibrary.load(Native Method)
	at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1941)
	at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1824)
	at java.lang.Runtime.load0(Runtime.java:809)
	at java.lang.System.load(System.java:1086)
	at com.kenai.jffi.internal.StubLoader.loadFromJar(StubLoader.java:367)
	at com.kenai.jffi.internal.StubLoader.load(StubLoader.java:254)
...
Caused by: java.lang.UnsatisfiedLinkError: java.lang.UnsatisfiedLinkError: /tmp/jffi4609635255293149753.so: /tmp/jffi4609635255293149753.so: failed to map segment from shared object: Operation not permitted
	at java.lang.ClassLoader$NativeLibrary.load(Native Method)
	at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1941)
	at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1824)
	at java.lang.Runtime.load0(Runtime.java:809)
	at java.lang.System.load(System.java:1086)
	at com.kenai.jffi.internal.StubLoader.loadFromJar(StubLoader.java:367)
	at com.kenai.jffi.internal.StubLoader.load(StubLoader.java:254)
...
Caused by: java.lang.UnsatisfiedLinkError: java.lang.UnsatisfiedLinkError: /tmp/jffi4609635255293149753.so: /tmp/jffi4609635255293149753.so: failed to map segment from shared object: Operation not permitted
	at java.lang.ClassLoader$NativeLibrary.load(Native Method)
	at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1941)
	at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1824)
	at java.lang.Runtime.load0(Runtime.java:809)
	at java.lang.System.load(System.java:1086)
...
file:/appl/iondev/bin/rabowriter609/lib/jruby-complete-1.7.26.jar!/jruby/kernel19/process.rb:13 warning: executable? does not in this environment and will return a dummy value
NotImplementedError: kill unsupported or native support failed to load
    kill at org/jruby/RubyProcess.java:973
    kill at org/jruby/RubyProcess.java:883
  (root) at -e:1

Linux cdcs470742.eu.rabodev.com 3.10.0-327.28.2.el7.x86_64 #1 SMP Mon Jun 27 14:48:28 EDT 2016 x86_64 x86_64 x86_64 GNU/Linux

Red Hat Enterprise Linux Server release 7.2 (Maipo)

Environment

Provide at least:

  • JRuby version (jruby -v) and command line (flags, JRUBY_OPTS, etc)
    -- 1.7.26
  • Operating system and platform (e.g. uname -a)
    -- see above

Other relevant info you may wish to add:

  • Installed or activated gems
    -- none
  • Application/framework version (e.g. Rails, Sinatra)
    -- none
  • Environment variables
    -- LD_LIBRARY_PATH unset in both environments. None others that seem relevant.

Expected Behavior

  • Describe your expectation of how JRuby should behave, perhaps by showing how CRuby/MRI behaves.
    -- would expect same behaviour as in RHEL5.
    -- have been able to "fix" this by explicitly adding the jffi.so lib to LD_LIBRARY_PATH on RHEL7
  • Provide an executable Ruby script or a link to an example repository.
    -- see above

Actual Behavior

  • Describe or show the actual behavior.
    -- see above
  • Provide text or screen capture showing the behavior.
    -- see above

Thanks.

@preetpalS
Copy link

Do you have SELinux enabled by any chance? If you do, do you still encounter the problem when it is disabled?

@kimptoc
Copy link
Author

kimptoc commented Mar 20, 2018

Yes, it would be enabled. Not able to test it without it being enabled unfortunately. :(

@headius
Copy link
Member

headius commented Mar 26, 2018

@kimptoc This is almost certainly related to SELinux, as @preetpalS guessed. The issue is that we unpack the jffi library, our native layer, to the environment-provided temp location. On SELinux, you are disallowed from loading executables or dynamic libraries from the shared temp directories.

You can work around it by setting a different TEMP dir that allows loading executables. We could probably do a better job reporting this error, but the native.verbose output makes it pretty clear there's a permission error of some sort.

@kimptoc
Copy link
Author

kimptoc commented Mar 27, 2018

Ok - thanks for the update. Shall we close the ticket then?

@headius
Copy link
Member

headius commented Mar 27, 2018

@kimptoc Yes, but maybe this deserves a more prominent entry on the wiki? Seems to come up frequently enough for a FAQ.

@headius headius closed this as completed Mar 27, 2018
@headius
Copy link
Member

headius commented Mar 27, 2018

I'm not sure if we can do a better error, but that would be at the jnr level in any case.

@headius headius added this to the Invalid or Duplicate milestone Mar 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants