Date: Mon, 09 Sep 2002 08:41:51 +0800 From: Huang wen hui <hwh@mail.gddsn.org.cn> To: Huang wen hui <hwh@mail.gddsn.org.cn> Cc: java <java@freebsd.org> Subject: Re: java core dump when using InetAddress.getHostName under current Message-ID: <3D7BEE4F.5010909@mail.gddsn.org.cn> References: <3D7B44C9.3030807@mail.gddsn.org.cn>
next in thread | previous in thread | raw e-mail | index | archive | help
Huang wen hui wrote: >hi, >The following example can cause java ( both classic and hotspot) core dump: >------------------------------------------------------------- >import java.net.*; > >public class TestGetHostByAddr { >public static void main(String[] args) throws Exception { >Socket socket = new Socket("www.freebsd.org", 80); >InetAddress localAddr = socket.getLocalAddress(); >String host = localAddr.getHostName(); >System.out.println("Local Host name is: "+ host); >socket.close(); >} >} > >-------------------------------------------------------------- >(gdb) run TestGetHostByAddr >Starting program: /usr/local/jdk1.3.1/bin/i386/native_threads/java_g >TestGetHostByAddr > >Program received signal SIGBUS, Bus error. >0x297ab90e in Java_java_net_InetAddressImpl_getHostByAddr >(env=0x806c2b0, this=0xbfbfeddc, addr=83994816) at >../../../src/solaris/native/java/net/InetAddressImpl.c:311 >311 ret = (*env)->NewStringUTF(env, hp->h_name); >(gdb) print hp->h_name >Error accessing memory address 0xffffffff: Bad address. >(gdb) bt >#0 0x297ab90e in Java_java_net_InetAddressImpl_getHostByAddr >(env=0x806c2b0, this=0xbfbfeddc, addr=83994816) >at ../../../src/solaris/native/java/net/InetAddressImpl.c:311 >#1 0x080ee1ac in ?? () >#2 0x080ea56d in ?? () >#3 0x080ea56d in ?? () >#4 0x080ea56d in ?? () >#5 0x2863af5d in StubRoutines::_code1 () from >/usr/local/jdk1.3.1/jre/lib/i386/client/libjvm_g.so >#6 0x283030b9 in JavaCalls::call_helper(JavaValue*, methodHandle*, >JavaCallArguments*, Thread*) (result=0xbfbff080, m=0xbfbfef54, >args=0xbfbfef80, >__the_thread__=0x806c218) at >/usr/ports/java/jdk13/work/hotspot1.3.1/src/share/vm/runtime/javaCalls.cpp:378 >#7 0x28302c54 in JavaCalls::call(JavaValue*, methodHandle, >JavaCallArguments*, Thread*) (result=0xbfbff080, method=ABI doesn't >define required function baseclass_offset >) >at >/usr/ports/java/jdk13/work/hotspot1.3.1/src/share/vm/runtime/javaCalls.cpp:287 >#8 0x2830f996 in jni_invoke(JNIEnv_*, JavaValue*, _jobject*, >JNICallType, _jmethodID*, JNI_ArgumentPusher*, Thread*) () >from /usr/local/jdk1.3.1/jre/lib/i386/client/libjvm_g.so >#9 0x2832438a in jni_CallStaticVoidMethod () from >/usr/local/jdk1.3.1/jre/lib/i386/client/libjvm_g.so >#10 0x08049346 in main (argc=0, argv=0xbfbff9bc) at >../../../../src/share/bin/java.c:323 >#11 0x08048bc1 in _start () > > > OK, Under -Current, InetAddress.getHostName should call gethostbyname_r in src/solaris/native/java/net/InetAddressImpl.c, but it call gethostbyname_r in /usr/src/lib/libc/net/gethostnamadr.c. --hwh To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-java" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3D7BEE4F.5010909>