Hi all, Would anyone happen to know the fix to this? This may or may not be directly related to Tomcat, but I noticed a somewhat relevant thread about segfaults occuring when invoking a JVM via JNI in the tomcat-dev mailing list archives.
Any advice would be appreciated on how to address this issue on JDK 1.3.1_01. Thanks very much, Eddie ____________ OVERVIEW: When running Tomcat 4.0 via the Java launcher in a gdb debugging session (Red Hat Linux 6.2, JDK 1.3.1_01), I get a SIGSEGV signal (Segmentation fault) when I execute some of the example JSPs/servlets. Since Tomcat is pure Java, I'm assuming the problem is most likely with the JVM and the way it handles signals, or possibly with gdb since I only see this behavior with gdb. The problem is fairly reproducible; I usually get it when I execute the "ErrorPage" JSP sample in Tomcat's "examples" webapp. Note that I don't see these signals when running the JVM standalone (outside of gdb). What's also weird is that I successfully tell gdb to "continue" after the segfault, and the app continues to work like nothing ever happend. As an aside, the reason why I did this test was because I was experiencing very similar problems in my own application that embeds a JVM via JNI. DESCRIPTION: Here is what I did to see the problem. First, I set the debugger in the environment, so that the jdk/bin/java script can run the java launcher in gdb: export DEBUG_PROG=gdb Next, I run the jdk/bin/java script: cd jdk1.3.1_01/bin java This brings up the Java launcher within gdb, and I run it as I specify the necessary arguments to startup Tomcat: GNU gdb 19991004 Copyright 1998 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"... (gdb) set args -classpath /u0/ruvinsky/tomcat4.bin/bin/bootstrap.jar:/u0/ruvinsky/src-java-launcher/jdk1.3.1_01/lib/tools.jar -Dcatalina.base=/u0/ruvinsky/tomcat4.bin -Dcatalina.home=/u0/ruvinsky/tomcat4.bin org.apache.catalina.startup.Bootstrap start (gdb) run Starting program: /u0/ruvinsky/src-java-launcher/jdk1.3.1_01/bin/i386/native_threads/java -classpath /u0/ruvinsky/tomcat4.bin/bin/bootstrap.jar:/u0/ruvinsky/src-java-launcher/jdk1.3.1_01/lib/tools.jar -Dcatalina.base=/u0/ruvinsky/tomcat4.bin -Dcatalina.home=/u0/ruvinsky/tomcat4.bin org.apache.catalina.startup.Bootstrap start [New Thread 1710 (manager thread)] [New Thread 1709 (initial thread)] [New Thread 1711] [New Thread 1712] [New Thread 1713] [New Thread 1714] [New Thread 1715] [New Thread 1716] [New Thread 1717] Starting service Tomcat-Standalone Apache Tomcat/4.0 [New Thread 1720] [New Thread 1721] [New Thread 1722] [New Thread 1723] [New Thread 1724] [New Thread 1725] [New Thread 1726] [New Thread 1727] [New Thread 1728] [New Thread 1729] [New Thread 1730] [New Thread 1731] Starting service Tomcat-Apache Apache Tomcat/4.0 [New Thread 1732] [Switching to Thread 1730] Program received signal SIGSEGV, Segmentation fault. 0x2bfee3f4 in ?? () (gdb) continue Continuing. I even tried building a debug version of the java launcher by hand in hope of finding a more detailed stack trace, but all I got was the following: (gdb) bt #0 0x806973d in ?? () #1 0x8060891 in ?? () #2 0x8060891 in ?? () #3 0x8060963 in ?? () #4 0x8060891 in ?? () #5 0x8060891 in ?? () #6 0x8060891 in ?? () #7 0x8060963 in ?? () #8 0x8060891 in ?? () #9 0x8060891 in ?? () #10 0x8060963 in ?? () #11 0x8060891 in ?? () #12 0x8060963 in ?? () #13 0x8060963 in ?? () #14 0x8060963 in ?? () #15 0x8060963 in ?? () #16 0x8060963 in ?? () #17 0x8060891 in ?? () #18 0x8060963 in ?? () #19 0x8060891 in ?? () #20 0x8060963 in ?? () #21 0x8060963 in ?? () #22 0x8060963 in ?? () #23 0x8060963 in ?? () #24 0x8060891 in ?? () #25 0x8060963 in ?? () #26 0x8060963 in ?? () #27 0x8060963 in ?? () #28 0x8060891 in ?? () #29 0x8060963 in ?? () #30 0x8060963 in ?? () #31 0x8060891 in ?? () #32 0x8060963 in ?? () #33 0x2add3d70 in StubRoutines::_code1 () from /u0/ruvinsky/src-java-launcher/jdk1.3.1_01/jre/lib/i386/client/libjvm.so #34 0x2abcb604 in JavaCalls::call_helper () from /u0/ruvinsky/src-java-launcher/jdk1.3.1_01/jre/lib/i386/client/libjvm.so #35 0x2ac2948d in os::os_exception_wrapper () from /u0/ruvinsky/src-java-launcher/jdk1.3.1_01/jre/lib/i386/client/libjvm.so #36 0x2abcb840 in JavaCalls::call () from /u0/ruvinsky/src-java-launcher/jdk1.3.1_01/jre/lib/i386/client/libjvm.so #37 0x2abcb1bb in JavaCalls::call_virtual () from /u0/ruvinsky/src-java-launcher/jdk1.3.1_01/jre/lib/i386/client/libjvm.so #38 0x2abcbccb in JavaCalls::call_virtual () from /u0/ruvinsky/src-java-launcher/jdk1.3.1_01/jre/lib/i386/client/libjvm.so #39 0x2abede80 in thread_entry () from /u0/ruvinsky/src-java-launcher/jdk1.3.1_01/jre/lib/i386/client/libjvm.so #40 0x2ac599c7 in JavaThread::thread_main_inner () from /u0/ruvinsky/src-java-launcher/jdk1.3.1_01/jre/lib/i386/client/libjvm.so #41 0x2ac56903 in JavaThread::run () from /u0/ruvinsky/src-java-launcher/jdk1.3.1_01/jre/lib/i386/client/libjvm.so #42 0x2ac27e73 in _start () from /u0/ruvinsky/src-java-launcher/jdk1.3.1_01/jre/lib/i386/client/libjvm.so #43 0x2aacc535 in pthread_start_thread (arg=0x7d3ffe40) at manager.c:241 (gdb) info shared >From To Syms Read Shared Object Library 0x2aac7000 0x2aad8ad8 Yes /lib/libpthread.so.0 0x2aad9000 0x2aae2e38 Yes /u0/ruvinsky/src-java-launcher/jdk1.3.1_01/jre/lib/i386/native_threads/libhpi.so 0x2aae3000 0x2addce90 Yes /u0/ruvinsky/src-java-launcher/jdk1.3.1_01/jre/lib/i386/client/libjvm.so 0x2addd000 0x2addfd0c Yes /lib/libdl.so.2 0x2ade1000 0x2aed537c Yes /lib/libc.so.6 0x2aed6000 0x2aeeb1c8 Yes /lib/libnsl.so.1 0x2aeec000 0x2af08098 Yes /lib/libm.so.6 0x2af09000 0x2af4af90 Yes /usr/lib/libstdc++-libc6.1-1.so.2 0x2aaab000 0x2aabecb0 Yes /lib/ld-linux.so.2 0x2af4b000 0x2af5d414 Yes /u0/ruvinsky/src-java-launcher/jdk1.3.1_01/jre/lib/i386/libverify.so 0x2af5e000 0x2af81fe8 Yes /u0/ruvinsky/src-java-launcher/jdk1.3.1_01/jre/lib/i386/libjava.so 0x2af82000 0x2af98360 Yes /u0/ruvinsky/src-java-launcher/jdk1.3.1_01/jre/lib/i386/libzip.so 0x340c6000 0x340ce9a0 Yes /lib/libnss_files.so.2 0x340cf000 0x340d8fb4 Yes /lib/libnss_nisplus.so.2 0x340d9000 0x340e21f8 Yes /lib/libnss_nis.so.2 0x343e9000 0x343f242c Yes /u0/ruvinsky/src-java-launcher/jdk1.3.1_01/jre/lib/i386/libnet.so 0x343fa000 0x343fd850 Yes /lib/libnss_dns.so.2 0x3497f000 0x3498d9fc Yes /lib/libresolv.so.2 As a reference, I built the Java launcher code included in the JDK 1.3.1_01 distribution, producing the replacement binary for: jdk1.3.1_01/bin/i386/native_threads/java I copied the source files out of the jdk1.3.1_01/src/src/launcher/ directory, and they consist of the following files: java.c java.h java_md.c java_md.h My build directory also contains the jdk1.3.1_01 subdirectory to include the JNI headers from and as a sample jdk to test the build output with. The following are my build commands (mainly borrowed from the JDK build process): cc -g -W -Wall -Werror -Wno-unused -Wno-parentheses -Di386 -DARCH='"i386"' -DSOLARIS2 -DRELEASE='"1.3.1-testing-110101"' -DFULL_VERSION='"1.3.1-testing-110101"' -D_LARGEFILE64_SOURCE -D_GNU_SOURCE -D_REENTRANT -D_LITTLE_ENDIAN -DUSE_APPHOME -DPROGNAME='"java"' -I./jdk1.3.1_01/include -I./jdk1.3.1_01/include/linux -c -o build/objs/java.o java.c cc -g -W -Wall -Werror -Wno-unused -Wno-parentheses -Di386 -DARCH='"i386"' -DSOLARIS2 -DRELEASE='"1.3.1-testing-110101"' -DFULL_VERSION='"1.3.1-testing-110101"' -D_LARGEFILE64_SOURCE -D_GNU_SOURCE -D_REENTRANT -D_LITTLE_ENDIAN -DUSE_APPHOME -DPROGNAME='"java"' -I./jdk1.3.1_01/include -I./jdk1.3.1_01/include/linux -c -o build/objs/java_md.o java_md.c cc -o jdk1.3.1/bin/i386/native_threads/java -z defs -Ljdk1.3.1_01/jre/lib/i386/native_threads -Ljdk1.3.1_01/jre/lib/i386/classic build/objs/java.o build/objs/java_md.o -lpthread -lhpi -ljvm -ldl -lc __________________________________________________ Do You Yahoo!? Find a job, post your resume. http://careers.yahoo.com -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>