Date: Wed, 04 Dec 2002 13:03:38 +0100 From: Marc van Kempen <marc@bowtie.nl> To: java@freebsd.org Cc: joao@bowtie.nl Subject: 1.3.1 -pl7 SIGSEGV Message-ID: <3DEDEF1A.9020504@bowtie.nl>
next in thread | raw e-mail | index | archive | help
I'm sending this message on behalf of my colleague, whose message sent to this list never surfaced, please cc: him when answering (joao@bowtie.nl): Hi All, While playing around a bit with the Lucene search engine i noticed some weird behaviour of the 1.3.1-pl7 jvm. After a little investigation i narrowed down the problem a bit, and created the following test code: ===== import java.io.*; class CrashTest { RandomAccessFile file = null; long length = 0; public CrashTest(File path) throws IOException { file = new RandomAccessFile(path, "r"); length = file.length(); } public static void main(String args[]) throws IOException, InterruptedException { if(args.length < 1) { System.out.println("Need a filename!"); return; } while(true) { try { CrashTest ct = new CrashTest(new File(args[0])); } catch(Exception e) { e.printStackTrace(); } } } } ==== Yah, I'm not the best java coder around :-) After compiling and running it with the path to an emtpy file as argument, it goes BOOM.. A Step by Step Walktrough: (joao@euripides) ~> touch foo (joao@euripides) ~> ls -l foo -rw-rw-r-- 1 joao joao 0 Dec 2 19:45 foo (joao@euripides) ~> java CrashTest foo SIGSEGV 11* segmentation violation < ... thread dump ...> It seems to run fine on the linux jdk, but as you might have guessed i rather run FreeBSD's own jvm. Hints, Tips and solutions are welcome.. Attached is the full thread dump.. Also after running this in java_g, we got the following stacktrace: Program received signal SIGABRT, Aborted. 0x280b8508 in kill () from /usr/lib/libc.so.4 (gdb) where #0 0x280b8508 in kill () from /usr/lib/libc.so.4 #1 0x280f858e in abort () from /usr/lib/libc.so.4 #2 0x28171745 in Abort () at ../../../src/share/javavm/runtime/interpreter.c:1449 #3 0x281af021 in panic ( format=0x2807d040 "\"%s\", line %d: assertion failure\n") at ../../../src/share/javavm/runtime/util.c:126 #4 0x28071e84 in open (fname=0x810bc00 "/home/joao/foo", flags=0) at ../../../../src/solaris/hpi/green_threads/src/iomgr.c:744 #5 0x2807c548 in open64_w (path=0x810bc00 "/home/joao/foo", oflag=0, mode=438) at ../../../../src/solaris/hpi/src/system_md.c:273 #6 0x2807c1ed in sysOpen (path=0x810bc00 "/home/joao/foo", oflag=0, mode=438) at ../../../../src/solaris/hpi/src/system_md.c:117 #7 0x28199c0c in JVM_Open (fname=0x810bc00 "/home/joao/foo", flags=0, mode=438) at ../../../src/share/javavm/runtime/jvm.c:1629 #8 0x2c32f425 in fileOpen (env=0x8057004, this=0x805b170, path=0x805b174, fid=0x812d430, flags=0) at ../../../src/share/native/java/io/io_util.c:201 #9 0x2c32d315 in Java_java_io_RandomAccessFile_open (env=0x8057004, this=0x805b170, path=0x805b174, w=0 '\000') at ../../../src/share/native/java/io/RandomAccessFile.c:43 #10 0x281b8f9d in args_done () from /usr/data/src/jdk1.3.1/j2sdk1.3.1/build/bsd-i386/bin/../lib/i386/classic/libjvm_g.so #11 0x2816111f in invokeJNINativeMethod (o=0x28eaf258, mb=0x812d55c, args_size=3, ee=0x8057004) at ../../../src/share/javavm/runtime/classruntime.c:489 #12 0x2817e2b2 in ExecuteJava_C (initial_pc=0xbfbfe2b4 "Ù", ee=0x8057004) at ../../../src/share/javavm/runtime/executeJava.c:1579 #13 0x28182b85 in jni_Invoke (env=0x8057004, self=0x805b048, methodID=0x81119d4, pushArguments=0x28182554 <jni_PushArgumentsVararg>, args=0xbfbfe330, info=778) at ../../../src/share/javavm/runtime/jni.c:774 #14 0x28185d7c in jni_CallStaticVoidMethodV (env=0x8057004, clazz=0x805b048, methodID=0x81119d4, args=0xbfbfe370 "P°\005\b\005") at ../../../src/share/javavm/runtime/jni.c:1947 #15 0x28190076 in checked_jni_CallStaticVoidMethod (env=0x8057004, cls=0x805b048, methodID=0x81119d4) at ../../../src/share/javavm/runtime/check_jni.c:741 #16 0x804932d in main (argc=1, argv=0xbfbfec40) at ../../../../src/share/bin/java.c:323 #17 0x8048b7d in _start () The offending line is the assert in ../../../src/share/javavm/runtime/util.c:126: ... while(1) { newfd = (*systable[SYS_OPEN].addr)(fname, flags, mode); if ((newfd != -1) || ((errno != EAGAIN) && (errno != EINTR))) { break; } } --> SIMPLE_INITFD(newfd, open); IO_UNLOCK(self); RESTORE_ERRNO(newfd); return newfd; } ... And SIMPLE_INITFD is defined as follows: #define SIMPLE_INITFD(newfd, funcname) \ if (1) { \ if (newfd >= 0) { \ Log1(1, #funcname " fd: %d \n", newfd); \ sysAssert(fd_flags[newfd] == 0); \ fd_flags[newfd] = 0; \ if (initialize_monitors(newfd) == HPI_FALSE) { /* Out of memory */ \ (*systable[SYS_CLOSE].addr)(newfd); /* Close new fd */ \ errno = ENOMEM; \ newfd = -1; \ } \ } else { \ Log1(1, #funcname " error: %d\n", errno); \ } \ } else \ ((void) 0) #endif The segfault occurs after a random number of accesses. Thank you for your time. Joao Schim (joao@bowtie.nl) -- ---------------------------------------------------- Marc van Kempen tel. +31 40 2 64 98 60 BowTie Technology fax. +31 40 2 64 98 61 Raiffeisenstraat 7 mailto:marc@bowtie.nl 5611 CH Eindhoven http://www.bowtie.nl ---------------------------------------------------- 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?3DEDEF1A.9020504>