Segmentation Fault in Java with IPv6

Asked by Kevin LaVergne on 2008-01-25

Hi. I keep getting a segmentation fault from Java (versions 1.4 and up). I noticed in the hs_err_pidxxx.log file, it looks like there is a problem with IPv6. ( The final non-native method in the stack trace is java.net.Inet6AddressImpl.lookupAllHostAddr(). ) This fault has happened with Eclipse and other applications, so I wrote a small app that just calls a single method ( java.net.InetAddress.getLocalHost(), which is higher up in the stack trace ) to verify where it's failing. This simple app fails with the segmentation fault on Ubuntu Gutsy (I haven't tried it on any previous version), but runs perfectly on Windows XP. It also runs with no problems in an Ubuntu Gutsy install in a VMWare VM on my XP machine, but not the full install to a HD partition.

I have searched all over the internet to find a solution, but have not found one. Mostly I just found suggestions to disable IPv6, but when I do that I can't connect to anything exception localhost. Does anyone know what could be causing this and what I can do to fix it? Thanks.

hs_err log below....

#
# An unexpected error has been detected by HotSpot Virtual Machine:
#
# SIGSEGV (0xb) at pc=0xb7efbba4, pid=11291, tid=3085182640
#
# Java VM: Java HotSpot(TM) Client VM (1.4.2_16-b05 mixed mode)
# Problematic frame:
# C [libc.so.6+0xb8ba4]
#

--------------- T H R E A D ---------------

Current thread (0x08057950): JavaThread "main" [_thread_in_native, id=11291]

siginfo:si_signo=11, si_errno=0, si_code=1, si_addr=0xbfaf509c

Registers:
EAX=0xbfcf4d70, EBX=0xb7f88ff4, ECX=0x00000002, EDX=0x00000004
ESP=0xbfaf5080, EBP=0xbfcf4d98, ESI=0xbfaf50b0, EDI=0x00080000
EIP=0xb7efbba4, CR2=0xbfaf509c, EFLAGS=0x00210293

Top of Stack: (sp=0xbfaf5080)
0xbfaf5080:
[error occurred during error reporting, step 100, id 0xb]

Stack: [0xbfb06000,0xbfcf8000), sp=0xbfaf5080, free space=-68k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C [libc.so.6+0xb8ba4]
C [libc.so.6+0xba620] getaddrinfo+0x130
C [libnet.so+0x473a] Java_java_net_Inet6AddressImpl_lookupAllHostAddr+0x14a
j java.net.Inet6AddressImpl.lookupAllHostAddr(Ljava/lang/String;)[[B+0
j java.net.InetAddress$1.lookupAllHostAddr(Ljava/lang/String;)[[B+4
j java.net.InetAddress.getAddressFromNameService(Ljava/lang/String;Ljava/net/InetAddress;)Ljava/lang/Object;+17
j java.net.InetAddress.getLocalHost()Ljava/net/InetAddress;+25
j InetTest.main([Ljava/lang/String;)V+8
v ~StubRoutines::call_stub
V [libjvm.so+0x1b1584]
V [libjvm.so+0x2670d9]
V [libjvm.so+0x1b17d6]
V [libjvm.so+0x1b9a9e]
V [libjvm.so+0x1c866d]
C [java+0x1880]
C [libc.so.6+0x16050] __libc_start_main+0xe0

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j java.net.Inet6AddressImpl.lookupAllHostAddr(Ljava/lang/String;)[[B+0
j java.net.InetAddress$1.lookupAllHostAddr(Ljava/lang/String;)[[B+4
j java.net.InetAddress.getAddressFromNameService(Ljava/lang/String;Ljava/net/InetAddress;)Ljava/lang/Object;+17
j java.net.InetAddress.getLocalHost()Ljava/net/InetAddress;+25
j InetTest.main([Ljava/lang/String;)V+8
v ~StubRoutines::call_stub

--------------- P R O C E S S ---------------

Java Threads: ( => current thread )
  0x080a4e20 JavaThread "CompilerThread0" daemon [_thread_blocked, id=11297]
  0x080a3fb8 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=11296]
  0x0808e8a8 JavaThread "Finalizer" daemon [_thread_blocked, id=11294]
  0x0808dcb8 JavaThread "Reference Handler" daemon [_thread_blocked, id=11293]
=>0x08057950 JavaThread "main" [_thread_in_native, id=11291]

Other Threads:
  0x0808ca08 VMThread [id=11292]
  0x080a6850 WatcherThread [id=11298]

VM state:not at safepoint (normal execution)

VM Mutex/Monitor currently owned by a thread: None

Heap
 def new generation total 576K, used 193K [0xab7c0000, 0xab860000, 0xabca0000)
  eden space 512K, 37% used [0xab7c0000, 0xab7f0730, 0xab840000)
  from space 64K, 0% used [0xab840000, 0xab840000, 0xab850000)
  to space 64K, 0% used [0xab850000, 0xab850000, 0xab860000)
 tenured generation total 1408K, used 0K [0xabca0000, 0xabe00000, 0xaf7c0000)
   the space 1408K, 0% used [0xabca0000, 0xabca0000, 0xabca0200, 0xabe00000)
 compacting perm gen total 4096K, used 1068K [0xaf7c0000, 0xafbc0000, 0xb37c0000)
   the space 4096K, 26% used [0xaf7c0000, 0xaf8cb1e0, 0xaf8cb200, 0xafbc0000)

Dynamic libraries:
08048000-08053000 r-xp 00000000 08:04 505655 /usr/lib/jvm/j2sdk1.4.2_16/bin/java
08053000-08055000 rwxp 0000a000 08:04 505655 /usr/lib/jvm/j2sdk1.4.2_16/bin/java
08055000-08137000 rwxp 08055000 00:00 0 [heap]
ab113000-ab121000 r-xp 00000000 08:04 478266 /usr/lib/jvm/j2sdk1.4.2_16/jre/lib/i386/libnet.so
ab121000-ab122000 rwxp 0000d000 08:04 478266 /usr/lib/jvm/j2sdk1.4.2_16/jre/lib/i386/libnet.so
ab122000-ab13e000 r-xs 00000000 08:04 478286 /usr/lib/jvm/j2sdk1.4.2_16/jre/lib/ext/sunjce_provider.jar
ab13e000-ab1fa000 r-xs 00000000 08:04 478339 /usr/lib/jvm/j2sdk1.4.2_16/jre/lib/ext/localedata.jar
ab1fa000-ab1fb000 ---p ab1fa000 00:00 0
ab1fb000-ab27b000 rwxp ab1fb000 00:00 0
ab27b000-ab27c000 ---p ab27b000 00:00 0
ab27c000-ab289000 rwxp ab27c000 00:00 0
ab289000-ab28c000 ---p ab289000 00:00 0
ab28c000-ab47c000 rwxp ab28c000 00:00 0
ab47c000-ab47d000 ---p ab47c000 00:00 0
ab47d000-ab48a000 rwxp ab47d000 00:00 0
ab48a000-ab48d000 ---p ab48a000 00:00 0
ab48d000-ab4fd000 rwxp ab48d000 00:00 0
ab4fd000-ab4fe000 ---p ab4fd000 00:00 0
ab4fe000-ab57e000 rwxp ab4fe000 00:00 0
ab57e000-ab5bd000 r-xp 00000000 08:04 196339 /usr/lib/locale/en_US.utf8/LC_CTYPE
ab5bd000-ab5be000 ---p ab5bd000 00:00 0
ab5be000-ab5cb000 rwxp ab5be000 00:00 0
ab5cb000-ab5ce000 ---p ab5cb000 00:00 0
ab5ce000-ab63e000 rwxp ab5ce000 00:00 0
ab63e000-ab63f000 ---p ab63e000 00:00 0
ab63f000-ab64c000 rwxp ab63f000 00:00 0
ab64c000-ab64f000 ---p ab64c000 00:00 0
ab64f000-ab6bf000 rwxp ab64f000 00:00 0
ab6bf000-ab6c0000 ---p ab6bf000 00:00 0
ab6c0000-ab743000 rwxp ab6c0000 00:00 0
ab743000-ab761000 rwxp ab743000 00:00 0
ab761000-ab762000 rwxp ab761000 00:00 0
ab762000-ab77f000 rwxp ab762000 00:00 0
ab77f000-ab780000 rwxp ab77f000 00:00 0
ab780000-ab781000 rwxp ab780000 00:00 0
ab781000-ab783000 rwxp ab781000 00:00 0
ab783000-ab79f000 rwxp ab783000 00:00 0
ab79f000-ab7a1000 rwxp ab79f000 00:00 0
ab7a1000-ab7bf000 rwxp ab7a1000 00:00 0
ab7bf000-ab860000 rwxp ab7bf000 00:00 0
ab860000-abca0000 rwxp ab860000 00:00 0
abca0000-abe00000 rwxp abca0000 00:00 0
abe00000-af7c0000 rwxp abe00000 00:00 0
af7c0000-afbc0000 rwxp af7c0000 00:00 0
afbc0000-b37c0000 rwxp afbc0000 00:00 0
b37c0000-b37cd000 r-xs 00000000 08:04 478289 /usr/lib/jvm/j2sdk1.4.2_16/jre/lib/ext/ldapsec.jar
b37cd000-b37f8000 rwxp b37cd000 00:00 0
b37f8000-b3875000 rwxp b37f8000 00:00 0
b3875000-b38fd000 rwxp b3875000 00:00 0
b38fd000-b5875000 rwxp b38fd000 00:00 0
b5875000-b5e4a000 r-xs 00000000 08:04 478338 /usr/lib/jvm/j2sdk1.4.2_16/jre/lib/charsets.jar
b5e4a000-b5e5c000 r-xs 00000000 08:04 478291 /usr/lib/jvm/j2sdk1.4.2_16/jre/lib/jce.jar
b5e5c000-b5f39000 r-xs 00000000 08:04 478337 /usr/lib/jvm/j2sdk1.4.2_16/jre/lib/jsse.jar
b5f39000-b5f4f000 r-xs 00000000 08:04 478290 /usr/lib/jvm/j2sdk1.4.2_16/jre/lib/sunrsasign.jar
b5f4f000-b5f99000 rwxp b5f4f000 00:00 0
b5f99000-b794e000 r-xs 00000000 08:04 478340 /usr/lib/jvm/j2sdk1.4.2_16/jre/lib/rt.jar
b794e000-b795c000 r-xp 00000000 08:04 478117 /usr/lib/jvm/j2sdk1.4.2_16/jre/lib/i386/libzip.so
b795c000-b795e000 rwxp 0000d000 08:04 478117 /usr/lib/jvm/j2sdk1.4.2_16/jre/lib/i386/libzip.so
b795e000-b797a000 r-xp 00000000 08:04 478104 /usr/lib/jvm/j2sdk1.4.2_16/jre/lib/i386/libjava.so
b797a000-b797c000 rwxp 0001b000 08:04 478104 /usr/lib/jvm/j2sdk1.4.2_16/jre/lib/i386/libjava.so
b797c000-b7989000 r-xp 00000000 08:04 478071 /usr/lib/jvm/j2sdk1.4.2_16/jre/lib/i386/libverify.so
b7989000-b798b000 rwxp 0000c000 08:04 478071 /usr/lib/jvm/j2sdk1.4.2_16/jre/lib/i386/libverify.so
b798b000-b7994000 r-xp 00000000 08:04 245204 /lib/tls/i686/cmov/libnss_files-2.6.1.so
b7994000-b7996000 rwxp 00008000 08:04 245204 /lib/tls/i686/cmov/libnss_files-2.6.1.so
b7996000-b799e000 r-xp 00000000 08:04 245206 /lib/tls/i686/cmov/libnss_nis-2.6.1.so
b799e000-b79a0000 rwxp 00007000 08:04 245206 /lib/tls/i686/cmov/libnss_nis-2.6.1.so
b79a0000-b79a7000 r-xp 00000000 08:04 245202 /lib/tls/i686/cmov/libnss_compat-2.6.1.so
b79a7000-b79a9000 rwxp 00006000 08:04 245202 /lib/tls/i686/cmov/libnss_compat-2.6.1.so
b79ac000-b79af000 r-xs 00000000 08:04 478287 /usr/lib/jvm/j2sdk1.4.2_16/jre/lib/ext/dnsns.jar
b79af000-b79b6000 r-xs 00000000 08:04 146605 /usr/lib/gconv/gconv-modules.cache
b79b6000-b79d9000 r-xp 00000000 08:04 245199 /lib/tls/i686/cmov/libm-2.6.1.so
b79d9000-b79db000 rwxp 00023000 08:04 245199 /lib/tls/i686/cmov/libm-2.6.1.so
b79db000-b79ef000 r-xp 00000000 08:04 245201 /lib/tls/i686/cmov/libnsl-2.6.1.so
b79ef000-b79f1000 rwxp 00013000 08:04 245201 /lib/tls/i686/cmov/libnsl-2.6.1.so
b79f1000-b79f3000 rwxp b79f1000 00:00 0
b79f3000-b7e11000 r-xp 00000000 08:04 478066 /usr/lib/jvm/j2sdk1.4.2_16/jre/lib/i386/client/libjvm.so
b7e11000-b7e2d000 rwxp 0041d000 08:04 478066 /usr/lib/jvm/j2sdk1.4.2_16/jre/lib/i386/client/libjvm.so
b7e2d000-b7e43000 rwxp b7e2d000 00:00 0
b7e43000-b7f87000 r-xp 00000000 08:04 245195 /lib/tls/i686/cmov/libc-2.6.1.so
b7f87000-b7f88000 r-xp 00143000 08:04 245195 /lib/tls/i686/cmov/libc-2.6.1.so
b7f88000-b7f8a000 rwxp 00144000 08:04 245195 /lib/tls/i686/cmov/libc-2.6.1.so
b7f8a000-b7f8e000 rwxp b7f8a000 00:00 0
b7f8e000-b7f90000 r-xp 00000000 08:04 245198 /lib/tls/i686/cmov/libdl-2.6.1.so
b7f90000-b7f92000 rwxp 00001000 08:04 245198 /lib/tls/i686/cmov/libdl-2.6.1.so
b7f92000-b7fa6000 r-xp 00000000 08:04 245209 /lib/tls/i686/cmov/libpthread-2.6.1.so
b7fa6000-b7fa8000 rwxp 00013000 08:04 245209 /lib/tls/i686/cmov/libpthread-2.6.1.so
b7fa8000-b7faa000 rwxp b7fa8000 00:00 0
b7fab000-b7faf000 rwxs 00000000 08:04 347339 /tmp/hsperfdata_klavergne/11291
b7faf000-b7fb5000 r-xp 00000000 08:04 478060 /usr/lib/jvm/j2sdk1.4.2_16/jre/lib/i386/native_threads/libhpi.so
b7fb5000-b7fb7000 rwxp 00005000 08:04 478060 /usr/lib/jvm/j2sdk1.4.2_16/jre/lib/i386/native_threads/libhpi.so
b7fb7000-b7fb9000 rwxp b7fb7000 00:00 0
b7fb9000-b7fd3000 r-xp 00000000 08:04 211812 /lib/ld-2.6.1.so
b7fd3000-b7fd5000 rwxp 00019000 08:04 211812 /lib/ld-2.6.1.so
bfafc000-bfb06000 rwxp bfafc000 00:00 0
bfb06000-bfb09000 ---p bfb06000 00:00 0
bfb74000-bfcfa000 rwxp bfb74000 00:00 0 [stack]
ffffe000-fffff000 r-xp 00000000 00:00 0 [vdso]

VM Arguments:
java_command: InetTest
Launcher Type: SUN_STANDARD

Environment Variables:
JAVA_HOME=/usr/lib/jvm/java-1.5.0-sun
PATH=/home/klavergne/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
USERNAME=klavergne
LD_LIBRARY_PATH=/usr/lib/jvm/j2sdk1.4.2_16/jre/lib/i386/client:/usr/lib/jvm/j2sdk1.4.2_16/jre/lib/i386:/usr/lib/jvm/j2sdk1.4.2_16/jre/../lib/i386
SHELL=/bin/bash
DISPLAY=:1.0

--------------- S Y S T E M ---------------

OS:lenny/sid

uname:Linux 2.6.22-14-generic #1 SMP Tue Dec 18 08:02:57 UTC 2007 i686
libc:glibc 2.6.1 NPTL 2.6.1
rlimit: STACK 8192k, CORE 50000k, NPROC 12286, NOFILE 1024, AS infinity
load average:91784437871174831635861673000226432789088495662485841938504044375493381440132612143058920217560735547104409228081740683144820087419576150211085949483221508554701659260077073877658710825785371557625856.00 0.00 -0.06

CPU:total 1 family 6, cmov, cx8, fxsr, mmx, sse, sse2

Memory: 4k page, physical 1555620k(143296k free), swap 2562328k(2562328k free)

vm_info: Java HotSpot(TM) Client VM (1.4.2_16-b05) for linux-x86, built on Sep 17 2007 00:34:43 by unknown with unknown compiler

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
Kevin LaVergne
Solved:
2008-02-02
Last query:
2008-02-02
Last reply:
2008-01-25

More of a concern is why you cannot use the network if you disable IPV6. I would diagnose/resolve that issue first.

Are you using network manager?

How is your network configured? Wired/Wireless? DHCP?

What's the contents of /etc/hosts

Kevin LaVergne (klavergne) said : #2

I was at work on a wired network. I just kind of gave up on it there, but tried again at home. When I tried to disable IPv6 at home (wireless), it worked just fine. Even the Java apps worked.

I then left IPv6 disabled and tried again at work the next day on their wireless. It worked there too. I also tried the wired network, and it also worked.

I'm not sure what caused it to finally work, but maybe it needed to have a "good" connection with IPv6 disabled (my home wireless) and then it was able to work at my office.