SIGSEGV in ld-linux.so when compiling recent JRuby versions (> rev #7907) [SOLVED]


#1

Hi, just in case, to help the average googler:

Since commit #7907, I had a strange bug when compiling JRuby with ant
jar-complete:
jar-complete:
[mkdir] Created dir:
/home/rvalyi/DEV/jruby_old/build/jar-complete/META-INF/jruby.home
[copy] Copying 697 files to
/home/rvalyi/DEV/jruby_old/build/jar-complete/META-INF/jruby.home
[copy] Copied 106 empty directories to 8 empty directories under
/home/rvalyi/DEV/jruby_old/build/jar-complete/META-INF/jruby.home
[copy] Copying 504 files to
/home/rvalyi/DEV/jruby_old/build/jar-complete
[java] #
[java] # A fatal error has been detected by the Java Runtime
Environment:
[java] #
[java] # SIGSEGV (0xb) at pc=0xb7fca3a2, pid=32060, tid=3076160400
[java] #
[java] # Java VM: Java HotSpot™ Client VM (14.0-b05 mixed
mode, sharing linux-x86 )
[java] # Problematic frame:
[java] # C [ld-linux.so.2+0xe3a2]
[java] #
[java] # An error report file with more information is saved as:
[java] # /home/rvalyi/DEV/jruby_old/hs_err_pid32060.log
[java] #
[java] # If you would like to submit a bug report, please visit:
[java] # http://java.sun.com/webapps/bugreport/crash.jsp
[java] # The crash happened outside the Java Virtual Machine in
native code.
[java] # See problematic frame for where to report the bug.
[java] #

BUILD FAILED
/home/rvalyi/DEV/jruby/build.xml:343: Java returned: 134

After investigating at the wmeissner found that compiling with ant jar
and then trying out that command:

./bin/jruby -rffi -e ‘module LibC; extend FFI::Library; attach_function :getpwuid, [ :int ], :pointer;end; p LibC.getpwuid(0)’
would result into the same error, meaning their is an error with the
getpwuid libc6 method on some Ubuntu installations.

Part of the C stack was:
Stack: [0xb7434000,0xb7535000], sp=0xb7533670, free space=1021k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code,
C=native code)
C [ld-linux.so.2+0xe3a2]
C [ld-linux.so.2+0x113f3]
C [libc.so.6+0x103de2]
C [ld-linux.so.2+0xd716]
C [libc.so.6+0x103ee1]
C [libc.so.6+0x104006] __libc_dlopen_mode+0x36
C [libc.so.6+0xdd6a7] __nss_lookup_function+0x2a7
C [libc.so.6+0xdd78c]
C [libc.so.6+0xdf43d] __nss_passwd_lookup2+0x4d
C [libc.so.6+0x95fbe] getpwuid_r+0x1ce
C [libc.so.6+0x957f7] getpwuid+0x77
C [jna7738.tmp+0x10ec7] ffi_call_SYSV+0x17
C [jna7738.tmp+0x10b74] ffi_call+0xb4
C [jna7738.tmp+0x3671]
C [jna7738.tmp+0x3d20] Java_com_sun_jna_Function_invokePointer+0x43
j
com.sun.jna.Function.invokePointer(I[Ljava/lang/Object;)Lcom/sun/jna/Pointer;+0
j
com.sun.jna.Function.invoke([Ljava/lang/Object;Ljava/lang/Class;)Ljava/lang/Object;+603
j
com.sun.jna.Function.invoke(Ljava/lang/Class;[Ljava/lang/Object;Ljava/util/Map;)Ljava/lang/Object;+194
j
com.sun.jna.Function.invoke(Ljava/lang/Class;[Ljava/lang/Object;)Ljava/lang/Object;+6
j
com.sun.jna.Function.invokePointer([Ljava/lang/Object;)Lcom/sun/jna/Pointer;+23
j
org.jruby.ext.ffi.jna.JNAProvider$PointerInvoker.invoke(Lorg/jruby/Ruby;Lcom/sun/jna/Function;[Ljava/lang/Object;)Lorg/jruby/runtime/builtin/IRubyObject;+7
j
org.jruby.ext.ffi.jna.DynamicMethodOneArg.call(Lorg/jruby/runtime/ThreadContext;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/RubyModule;Ljava/lang/String;Lorg/jruby/runtime/builtin/IRubyObject;)Lorg/jruby/runtime/builtin/IRubyObject;+46
j
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/RubyClass;Lorg/jruby/runtime/ThreadContext;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/builtin/IRubyObject;)Lorg/jruby/runtime/builtin/IRubyObject;+57

Finally, we just tried out what Charles Nutter found some weeks ago
here:

Meaning that the libc6-i68 library seems broken on Ubuntu, at least
the 8.10 and 7.10 versions I tried.
Again as nothing important was depending on it, I just removed the
libc6-i68 package with apt-get remove libc6-i68

And then everything worked again like a charm.

Happy hacking!

Raphaël Valyi.


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

#2

Raphaël Valyi wrote:

Finally, we just tried out what Charles Nutter found some weeks ago
here: http://blog.headius.com/2008/08/libdl-dldebuginitialize-problem-solved.html

Meaning that the libc6-i68 library seems broken on Ubuntu, at least
the 8.10 and 7.10 versions I tried.
Again as nothing important was depending on it, I just removed the
libc6-i68 package with apt-get remove libc6-i68

And then everything worked again like a charm.

This strongly points toward there being something “wrong” with JNA on
Ubuntu when libc6-i686 is installed. We need to investigate that
possibility, and if it turns out it’s JNA causing the crashing, we must
do two things:

  1. Modify jna-posix to not even load JNA when native.enabled=false (i.e.
    load it reflectively
  2. Fix JNA

See my dev post and http://jira.codehaus.org/browse/JRUBY-3084

  • Charlie

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email