Name: laC46010 Date: 09/18/98
VM (1.2fcs-J) crashes with segmentation violation while executing the
following example. This is an intermittent runtime bug. It takes approximately
3 - 10 minutes of CPU time on Ultra-1 (167MHz, 128Mbyte) to crash VM.
But sometimes it may go to the end of the test without a crash. It appears
very rarely on slower platforms.
The bug can be tracked down more quickly with low -Xmx value. Note
also the next fact. After successful memory allocation and following
memory release with explicit garbage collector call, only half of the heap is
available, if -Xmx value is big enough or no -Xmx value is used at all.
This can be due to a separate garbage collector bug.
Test example and VM diagnostics follow:
-------------------------------------------------------
novo35% cat test.java
import java.io.PrintStream;
public class test {
final static boolean debug = true;
public static void main(String args[]) {
for(int n = 0; n < 256 ; n++) run(args, System.out);
}
public static int run(String args[], PrintStream out) {
Runtime rt = Runtime.getRuntime();
int start = 64*1024*1024;
int heap = start;
int i = 0, j = 0;
byte arr[];
for(i = start/2; i != 1; i/=2) {
try {
arr = new byte[heap];
} catch (OutOfMemoryError e) {
out.println("allocation is not done: i = " + i + ", heap = " + heap);
arr = null;
heap-=i;
continue;
}
out.println("allocation is done: i = " + i + ", heap = " + heap);
heap+=i;
arr = null;
rt.gc();
}
try {
for(i = heap - 32768, j = 0 ; j < 2; i-=1) {
try {
arr = new byte[heap];
out.println("Array allocated. j = " + j++);
Object o = new C0();
} catch (OutOfMemoryError e) {
if ( debug ) out.println("Object allocation is not done: i = " + i);
if ( debug ) out.println("total " + rt.totalMemory());
if ( debug ) out.println("free " + rt.freeMemory());
arr = null;
rt.gc();
if ( debug ) out.println("free " + rt.freeMemory());
continue;
}
arr = null;
rt.gc();
j++;
if ( debug ) out.println("Object allocation is done: i = " + i);
if ( debug ) out.println("total " + rt.totalMemory());
if ( debug ) out.println("free " + rt.freeMemory());
}
} catch (OutOfMemoryError e) {
rt.gc();
return 2;
}
return 0;
}
}
class C0 {
double f00, f01, f02, f03, f04, f05, f06, f07;
double f08, f09, f0a, f0b, f0c, f0d, f0e, f0f;
// 16x8byte = 128b
}
novo60% java -version
java version "1.2fcs"
Classic VM (build JDK-1.2fcs-J, green threads, sunwjit)
novo60% javac test.java
novo60% java -verify test
allocation is not done: i = 33554432, heap = 67108864
allocation is done: i = 16777216, heap = 33554432
allocation is done: i = 8388608, heap = 50331648
allocation is not done: i = 4194304, heap = 58720256
allocation is not done: i = 2097152, heap = 54525952
allocation is done: i = 1048576, heap = 52428800
allocation is done: i = 524288, heap = 53477376
allocation is not done: i = 262144, heap = 54001664
allocation is not done: i = 131072, heap = 53739520
allocation is not done: i = 65536, heap = 53608448
allocation is not done: i = 32768, heap = 53542912
allocation is done: i = 16384, heap = 53510144
allocation is done: i = 8192, heap = 53526528
allocation is done: i = 4096, heap = 53534720
allocation is done: i = 2048, heap = 53538816
allocation is not done: i = 1024, heap = 53540864
allocation is done: i = 512, heap = 53539840
allocation is done: i = 256, heap = 53540352
allocation is done: i = 128, heap = 53540608
allocation is done: i = 64, heap = 53540736
allocation is not done: i = 32, heap = 53540800
allocation is not done: i = 16, heap = 53540768
allocation is not done: i = 8, heap = 53540752
allocation is not done: i = 4, heap = 53540744
allocation is not done: i = 2, heap = 53540740
Object allocation is not done: i = 53507970
total 3088376
free 2923800
free 2924040
... SKIP ...
Object allocation is not done: i = 53507938
total 3088376
free 2924040
free 2924040
Array allocated. j = 0
SIGSEGV 11* segmentation violation
si_signo [11]: SIGSEGV 11* segmentation violation
si_errno [0]: Error 0
si_code [1]: SEGV_MAPERR [addr: 0x4]
stackpointer=effff218
Full thread dump Classic VM (JDK-1.2fcs-J, green threads):
"Finalizer" (TID:0xebc986e0, sys_thread_t:0x6fb60, state:CW) prio=8
at java.lang.Object.wait(Native Method)
at java.lang.ref.ReferenceQueue.remove(Compiled Code)
at java.lang.ref.ReferenceQueue.remove(Compiled Code)
at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:174)
"Reference Handler" (TID:0xebc984b8, sys_thread_t:0x74dc0, state:CW) prio=10
at java.lang.Object.wait(Native Method)
at java.lang.Object.wait(Compiled Code)
at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:209)
"Signal dispatcher" (TID:0xebc984f0, sys_thread_t:0x74008, state:CW) prio=5
"main" (TID:0xebc983a8, sys_thread_t:0x28900, state:R) prio=5
at java.net.URLClassLoader.findClass(Compiled Code)
at java.lang.ClassLoader.loadClass(Compiled Code)
at java.lang.ClassLoader.loadClass(Compiled Code)
at sun.misc.Launcher$AppClassLoader.loadClass(Compiled Code)
at java.lang.ClassLoader.loadClass(Compiled Code)
at test.run(Compiled Code)
at test.main(Compiled Code)
Monitor Cache Dump:
sun.misc.Launcher$AppClassLoader@EBC99810/EBCE1FF0: owner "main" (0x28900) 3 entries
java.lang.ref.ReferenceQueue$Lock@EBC986F0/EBCCFA10: <unowned>
Waiting to be notified:
"Finalizer" (0x6fb60)
java.lang.ref.Reference$Lock@EBC984C8/EBCCF4C0: <unowned>
Waiting to be notified:
"Reference Handler" (0x74dc0)
sun.misc.Launcher$ExtClassLoader@EBC99480/EBCE0350: owner "main" (0x28900) 1 entry
Registered Monitor Dump:
PCMap lock: <unowned>
utf8 hash table: <unowned>
JNI pinning lock: <unowned>
JNI global reference lock: <unowned>
BinClass lock: <unowned>
Class linking lock: <unowned>
System class loader lock: <unowned>
Code rewrite lock: <unowned>
Heap lock: <unowned>
Monitor cache lock: owner "main" (0x28900) 1 entry
Dynamic loading lock: <unowned>
Monitor IO lock: <unowned>
User signal monitor: <unowned>
Waiting to be notified:
"Signal dispatcher" (0x74008)
Child death monitor: <unowned>
I/O monitor: <unowned>
Alarm monitor: <unowned>
Waiting to be notified:
<unknown thread> (0x2b7d8)
Thread queue lock: owner "main" (0x28900) 1 entry
Monitor registry: owner "main" (0x28900) 1 entry
SIGABRT 6* abort (generated by abort(3) routine)
si_signo [6]: SIGABRT 6* abort (generated by abort(3) routine)
si_errno [0]: Error 0
si_code [0]: SI_USER [pid: 11919, uid: 1186]
stackpointer=effff218
Full thread dump Classic VM (JDK-1.2fcs-J, green threads):
"Finalizer" (TID:0xebc986e0, sys_thread_t:0x6fb60, state:CW) prio=8
at java.lang.Object.wait(Native Method)
at java.lang.ref.ReferenceQueue.remove(Compiled Code)
at java.lang.ref.ReferenceQueue.remove(Compiled Code)
at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:174)
"Reference Handler" (TID:0xebc984b8, sys_thread_t:0x74dc0, state:CW) prio=10
at java.lang.Object.wait(Native Method)
at java.lang.Object.wait(Compiled Code)
at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:209)
"Signal dispatcher" (TID:0xebc984f0, sys_thread_t:0x74008, state:CW) prio=5
"main" (TID:0xebc983a8, sys_thread_t:0x28900, state:R) prio=5
at java.net.URLClassLoader.findClass(Compiled Code)
at java.lang.ClassLoader.loadClass(Compiled Code)
at java.lang.ClassLoader.loadClass(Compiled Code)
at sun.misc.Launcher$AppClassLoader.loadClass(Compiled Code)
at java.lang.ClassLoader.loadClass(Compiled Code)
at test.run(Compiled Code)
at test.main(Compiled Code)
Monitor Cache Dump:
sun.misc.Launcher$AppClassLoader@EBC99810/EBCE1FF0: owner "main" (0x28900) 3 entries
java.lang.ref.ReferenceQueue$Lock@EBC986F0/EBCCFA10: <unowned>
Waiting to be notified:
"Finalizer" (0x6fb60)
java.lang.ref.Reference$Lock@EBC984C8/EBCCF4C0: <unowned>
Waiting to be notified:
"Reference Handler" (0x74dc0)
sun.misc.Launcher$ExtClassLoader@EBC99480/EBCE0350: owner "main" (0x28900) 1 entry
Registered Monitor Dump:
PCMap lock: <unowned>
utf8 hash table: <unowned>
JNI pinning lock: <unowned>
JNI global reference lock: <unowned>
BinClass lock: <unowned>
Class linking lock: <unowned>
System class loader lock: <unowned>
Code rewrite lock: <unowned>
Heap lock: <unowned>
Monitor cache lock: owner "main" (0x28900) 1 entry
Dynamic loading lock: <unowned>
Monitor IO lock: <unowned>
User signal monitor: <unowned>
Waiting to be notified:
"Signal dispatcher" (0x74008)
Child death monitor: <unowned>
I/O monitor: <unowned>
Alarm monitor: <unowned>
Waiting to be notified:
<unknown thread> (0x2b7d8)
Thread queue lock: owner "main" (0x28900) 1 entry
Monitor registry: owner "main" (0x28900) 1 entry
-----------------------------------------------------
======================================================================
Name: dkC59003 Date: 05/18/99
This problem also affects the HotSpot 1.0 for Sparc:
Tested on:
hardware: Ultra-1 167MHz, RAM 128Mb
software: JDK 1.2-fcsV, hotspot1_0rc1_hp-bin-solsparc-mar_12
>>>> java -version
java version "1.2"
HotSpot VM (1.0fcs, mixed mode, internal product build)
>>>> java test
allocation is not done: i = 33554432, heap = 67108864
allocation is done: i = 16777216, heap = 33554432
. . .
SIGABRT 6* abort (generated by abort(3) routine)
si_signo [6]: SIGABRT 6* abort (generated by abort(3) routine)
si_errno [0]: Error 0
si_code [0]: SI_USER [pid: 27071, uid: 1182]
stackpointer=effff320
. . .
Abort (core dumped)
======================================================================