Name: mf23781 Date: 04/27/98
Originally found on OS390, MVS 3.00 (winmvs13), JDK1.1.4
If the JVM is compiled with the ALLOC_BARRIERS flag, then
invocation of the allocation barrier mechanism (getState or
DoASChangeCallback) will cause two threads, one for yellow
notification and one for red notification to be created as
user threads. These threads are in an infinite loop, waiting
for notification from the GC as to allocation state change.
Because the threads are user threads, and not daemon threads,
the JVM will never complete. Changing these threads to daemon
threads upon creation (ie in the constructor) will solve the problem.
This has been fixed with the following:
In
.../share/java/sun/sun/misc/VM.java, Line 144:
Original code:
VMNotifierThread(String s) {
super(s);
}
Suggested code:
VMNotifierThread(String s) {
super(s);
setDaemon(true);
}
Testcase:
---------
This is our test program which demonstrates the allocation
barriers bug in the original Sun code. The JVM will never
terminate as there are two non-daemon threads created which go
into an infinite loop.
/***************************************************
*
* This simple class demonstrates a bug of the Allocation barriers scheme
* in Suns sun.misc.VM implementation.
* The bugs result is that the program will never finish
*
***************************************************/
import sun.misc.VM;
public class ASBug
{
static public void main(String[] argv)
{
System.out.println ("The current allocation state of the system is "+
allocStateColor(VM.getState()));
}
static String[] color = new String[3];
static
{
color[0] = new String("GREEN");
color[1] = new String("YELLOW");
color[2] = new String("RED");
}
public static String allocStateColor(int as_new)
{ return color[as_new-1]; }
}
This gives the following results:
Solaris 114 JDK = JVM hangs (run on duke).
Solaris 1.2 JDK = Pass.
The test run against 1.2 JDK was run on Duke which has the
licensee suppiled 1.2 JDK and Javabld8 which has the in-house
built 1.2 Solaris JDK. In both these cases the test passes.
Basically all this defect is doing i passing a fix we have implemented back to you for inclusion.
======================================================================
- relates to
-
JDK-4129862 Respecify soft references, remove guarded references and the memory-advice API
-
- Closed
-