JDK-4791798 : JNI Apps crash with SIGABRT using 1.4.1_01 on Linux
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 1.4.1_01
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: linux_redhat_7.2
  • CPU: x86
  • Submitted: 2002-12-11
  • Updated: 2012-10-08
  • Resolved: 2003-03-26
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other Other
1.4.1_03 03Fixed 1.4.2Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Relates :  
Description
On Red Hat Linux release 7.3 Kernel 2.4.18-3smp on an i686 with  
j2sdk-1_4_1_01-linux-i586
java version "1.4.1_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_01-b01)
Java HotSpot(TM) Client VM (build 1.4.1_01-b01, mixed mode)

Using gcc version 2.96 20000731 (Red Hat Linux 7.3 2.96-110)

JNI program crash (with SIGABRT) while re-throwing an exception from the
JNI layer in JDK 1.4.1 on Linux.

Actual Output from testcase
--------------------------
Hello world!
before doit
throwing
Abort 


This behavior is not seen with JDK 1.2.2_014 and on Solaris using JDK 1.4.1_01.

Expected / Actual Output
------------------------
Hello world!
before doit
throwing
re-throwing in bad_alloc
caught bad_alloc

Testcase is located in the attachments and the native stack trace is below.

GNU gdb Red Hat Linux (5.1.90CVS-5)
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain 
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux"...
(no debugging symbols found)...
Core was generated by `java -Djava.library.path=. HelloWorld'.
Program terminated with signal 6, Aborted.
Reading symbols from /lib/i686/libpthread.so.0...
(no debugging symbols found)...done.
Loaded symbols for /lib/i686/libpthread.so.0
Reading symbols from /lib/libdl.so.2...(no debugging symbols found)...done.
Loaded symbols for /lib/libdl.so.2
Reading symbols from /lib/i686/libc.so.6...(no debugging symbols 
found)...done.
Loaded symbols for /lib/i686/libc.so.6
Reading symbols from /lib/ld-linux.so.2...(no debugging symbols 
found)...done.
Loaded symbols for /lib/ld-linux.so.2
Reading symbols from 
/home/albert/j2sdk1.4.1_01/jre/lib/i386/client/libjvm.so...done.
Loaded symbols for /home/albert/j2sdk1.4.1_01/jre/lib/i386/client/libjvm.so
Reading symbols from /lib/libnsl.so.1...done.
Loaded symbols for /lib/libnsl.so.1
Reading symbols from /lib/i686/libm.so.6...done.
Loaded symbols for /lib/i686/libm.so.6
Reading symbols from 
/home/albert/j2sdk1.4.1_01/jre/lib/i386/native_threads/libhpi.so...done.
Loaded symbols for 
/home/albert/j2sdk1.4.1_01/jre/lib/i386/native_threads/libhpi.so
Reading symbols from /home/albert/j2sdk1.4.1_01/jre/lib/i386/libverify.so...
done.
Loaded symbols for /home/albert/j2sdk1.4.1_01/jre/lib/i386/libverify.so
Reading symbols from 
/home/albert/j2sdk1.4.1_01/jre/lib/i386/libjava.so...done.
Loaded symbols for /home/albert/j2sdk1.4.1_01/jre/lib/i386/libjava.so
Reading symbols from 
/home/albert/j2sdk1.4.1_01/jre/lib/i386/libzip.so...done.
Loaded symbols for /home/albert/j2sdk1.4.1_01/jre/lib/i386/libzip.so
Reading symbols from /lib/libnss_files.so.2...done.
Loaded symbols for /lib/libnss_files.so.2
Reading symbols from /home/albert/CBOE/linux/libhello.so...done.
Loaded symbols for /home/albert/CBOE/linux/libhello.so
#0  0x42029241 in kill () from /lib/i686/libc.so.6
(gdb) where
#0  0x42029241 in kill () from /lib/i686/libc.so.6
#1  0x40033c4b in raise () from /lib/i686/libpthread.so.0
#2  0x4202a7d2 in abort () from /lib/i686/libc.so.6
#3  0x40345125 in __default_terminate () at ../../gcc/libgcc2.c:-1
#4  0x40345142 in __terminate ()
   from /home/albert/j2sdk1.4.1_01/jre/lib/i386/client/libjvm.so
#5  0x4c6fde41 in __rethrow (index=0x4c7042ec)
   from /home/albert/CBOE/linux/libhello.so
#6  0x4c6fcc32 in TestClass::doit (this=0xbfffd6c3) at TestClass.cpp:21
#7  0x4c6fcd4b in TestClass::run (this=0xbfffd6c3) at TestClass.cpp:27
#8  0x4c6fcb92 in Java_HelloWorld_displayHelloWorld (env=0x8051bec,
    obj=0xbfffd700) at HelloWorldImpl.cpp:12
#9  0x423f9b52 in ?? ()
#10 0x423f3ddb in ?? ()
#11 0x423f1104 in ?? ()
#12 0x40245116 in JavaCalls::call_helper ()
   from /home/albert/j2sdk1.4.1_01/jre/lib/i386/client/libjvm.so
#13 0x402dff45 in os::os_exception_wrapper ()
   from /home/albert/j2sdk1.4.1_01/jre/lib/i386/client/libjvm.so
#14 0x402451f4 in JavaCalls::call ()
   from /home/albert/j2sdk1.4.1_01/jre/lib/i386/client/libjvm.so
#15 0x4024d01c in jni_invoke_static ()
   from /home/albert/j2sdk1.4.1_01/jre/lib/i386/client/libjvm.so
#16 0x4025aa2a in jni_CallStaticVoidMethod ()
   from /home/albert/j2sdk1.4.1_01/jre/lib/i386/client/libjvm.so
#17 0x080494a5 in strcpy ()
#18 0x42017499 in __libc_start_main () from /lib/i686/libc.so.6
(gdb)

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: 1.4.1_03 mantis FIXED IN: 1.4.1_03 mantis INTEGRATED IN: 1.4.1_03 mantis
14-06-2004

EVALUATION This is fixed in next release JDK 1.4.2-b09 build. Not yet shipped. until an escalation is filed you will have to wait until next product ship. JPSE team has been added to interest list. ###@###.### 2002-12-11 ---------------------------------- This is dup of 4709333, the abort is caused by two incompatible libstdc++ (one for libjvm.so and another one for the JNI app) being loaded into memory at the same time. Please also see 4694590, which tracks the compatibility issues of C++ ABI. I fixed the problem in JDK-1.4.2-b08 using the following two bugids: 4776723 RFE: enable linker mapfiles for Linux 4706607 Linux: use gcc to compile c++ files Before 1.4.2 is shipped, user can do either one of the three to work around the problem: + preload the libstdc++.so that the JNI library is linked with (run "ldd" on the JNI library to figure out which libstdc++ is used, then set LD_PRELOAD to include the library) + when building the JNI library, statically link with libstdc++ and force linker to resolve symbols within the library. To do this, you need to add "-Wl,-Bsymbolic -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic" to the gcc/g++ command line when linking the library. + build JNI Library on Redhat 6.1/6.2. It's OK to deploy on any release but the build platform needs to be the same as that being used by JDK. ###@###.### 2002-12-11 This needs to be backported. Re-assigning to JPSE team
11-12-2002