Name: ks84122 Date: 11/14/2002
The example below hangs the debug VM in the latest mantis build (b07).
It doesn't hang without the GC flags. (Same program crashes the debug VM in
1.4.1 FCS).
Looks like the VM is hang when it starts finalizing the objects. Please see
the stack dump below. The java threads are blocked at a safepoint (GC ?). The threads don't seem to be able to resume after this safepoint.
The source of the test case is in the original description from HP below.
bash-2.00$ /java/re/jdk/1.4.2/latest/binaries/solaris-sparc/bin/java_g
-Xconcgc -XX:+UseParNewGC Garbage1 none
VM option '+UseParNewGC'
Created 10000
Created 20000
^\Full thread dump Java HotSpot(TM) Client VM (1.4.2-beta-b07-debug
mixed mode):
"Signal Dispatcher" daemon prio=10 tid=0x00130428 nid=0xe runnable [0..0]
Thread state: _thread_blocked_trans
Thread: 0x00130428 [0x e] State: _at_safepoint_suspend pc: 0x00000000
"Surrogate Locker Thread (CMS)" daemon prio=5 tid=0x0012ebd0 nid=0xc
runnable [0
..0]
Thread state: _thread_in_native
Thread: 0x0012ebd0 [0x c] State: _at_safepoint pc: 0x00000000
"Finalizer" daemon prio=8 tid=0x00128780 nid=0xb in Object.wait()
[fb181000..fb1
81810]
Thread state: _thread_blocked
Thread: 0x00128780 [0x b] State: _at_safepoint pc: 0x00000000
at java.lang.Object.wait(Native Method)
- waiting on <0xf0e100f0> (a java.lang.ref.ReferenceQueue$Lock)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:111)
- locked <0xf0e100f0> (a java.lang.ref.ReferenceQueue$Lock)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:127)
at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:159)
"Reference Handler" daemon prio=10 tid=0x001265a8 nid=0xa runnable
[fb281000..fb
281810]
Thread state: _thread_blocked_trans
Thread: 0x001265a8 [0x a] State: _at_safepoint_suspend pc: 0x00000000
at java.lang.Object.wait(Native Method)
- waiting on <0xf0e11090> (a java.lang.ref.Reference$Lock)
at java.lang.Object.wait(Object.java:426)
at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:113)
- locked <0xf0e11090> (a java.lang.ref.Reference$Lock)
"main" prio=5 tid=0x0003ea68 nid=0x1 runnable [ffbed000..ffbee170]
Thread state: _thread_blocked
Thread: 0x0003ea68 [0x 1] State: _call_back pc: 0x00000000
at java.lang.ref.Finalizer.register(Finalizer.java:72)
at Garbage1.main(Garbage1.java:56)
"VM Thread" prio=5 tid=0x001247d8 nid=0x9 runnable
"VM Periodic Task Thread" prio=10 tid=0x0014d9d8 nid=0x10 waiting on
condition
"Suspend Checker Thread" prio=10 tid=0x0012f890 nid=0xd runnable
Compiler thread printing unimplemented.
Original description from HP:
----------------------------
Server and client debug VM (build 1.4.1-b21-debug, mixed mode) crashes when using -Xconcgc and -XX:+UseParNewGC options together on Solaris.
$ uname -a
SunOS hppdl694 5.8 Generic_108528-13 sun4u sparc SUNW,Ultra-4
$ jdk141_b21/jdk1.4.1/bin/java_g -XX:+UseParNewGC -Xconcgc -verbose:gc Garbage1 none
VM option '+UseParNewGC'
#
# HotSpot Virtual Machine Error, Internal Error
# Please report this error at
# http://java.sun.com/cgi-bin/bugreport.cgi
#
# Java VM: Java HotSpot(TM) Client VM (1.4.1-b21-debug mixed mode)
#
# Fatal: must own lock CompactibleFreeListSpace._lock
#
# Error ID: /BUILD_AREA/jdk1.4.1/hotspot/src/share/vm/runtime/mutexLocker.cpp, 93 [ Patched ]
#
# Problematic Thread: prio=10 tid=0xb4448 nid=0x4 runnable
#
Dumping core....
Abort(coredump)
----------------------------
The source code of the test case is in the following:
// Garbage1.java
// java Garbage1 [none|before|after]
// Demonstration of the garbage collector and finalization
class Chair
{
static boolean gcrun = false;
static boolean f = false;
static int created = 0;
static int finalized = 0;
int i;
Chair()
{
i = ++ created;
if((created % 10000) == 0)
System.out.println("Created " + created);
}
protected void finalize()
{
if(!gcrun)
{
gcrun = true;
System.out.println("Beginning to finalize after " + created +
" Chairs have been created");
}
if(i == 50000)
{
System.out.println("Finalizing Chair #300000, " + "Setting flag to" +
" stop Chair creation");
f = true;
}
finalized ++;
if(finalized >= created)
System.out.println("All " + finalized + " finalized");
}
}
public class Garbage1
{
public static void main(String [] args)
{
int count = 1;
long t1 = System.currentTimeMillis();
if (args.length == 0)
{
System.err.println("Usage: \n" + "java Garbage1 before\n or:\n" +
"java Garbage1 after");
return;
}
while(!Chair.f)
{
new Chair();
new String("To take up space");
// if (count++ % 50000 == 0)
// System.gc();
}
System.out.println("After all Chairs have been created:\n" +
"total created = " + Chair.created +
", total finalized = " + Chair.finalized);
if(args[0].equals("before"))
{
System.out.println("gc():");
System.gc();
System.out.println("runFinalization():");
System.runFinalization();
}
System.out.println("bye!");
if(args[0].equals("after"))
System.runFinalizersOnExit(true);
long t2 = System.currentTimeMillis();
System.out.println("Finish: " + (t2-t1) + "ms" );
}
}
(Review ID: 166982)
======================================================================