-
Bug
-
Resolution: Not an Issue
-
P4
-
None
-
1.3.0
-
sparc
-
solaris_7
Name: elR10090 Date: 06/02/2000
J2SDK 1.3.0beta (Sparc) Client HS fails to stop with System.exit()
when many concurrent threads are executed. To reproduce this failure,
try to execute the test below:
>>>> javac thread005.java
>>>> java -server thread005 500 ; echo $status
. . .
95 -- it finishes OK
>>>> java thread005 500 ; echo $status
java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-beta)
Java HotSpot(TM) Client VM (build 1.3-beta, mixed mode)
Trying to start 500 threads:
Threads started: 1
Threads started: 2
. . .
Threads started: 500
The test have PASSED.
. . . -- it hangs here
Please note, that this test passes against the Server HS; and it also will
pass against Client HS, if the following line in the source is un-commented:
// XXX thread[i].setPriority(Thread.MIN_PRIORITY);
---- The test source file "thread005.java":
/* @(#)thread005.java 1.1 00/06/02
* Copyright 06/02/00 Sun Microsystems, Inc.
*/
import java.io.*;
/**
* Try to start the given number of threads starting simultaneously.
*/
public class thread005 extends Thread {
/**
* Enable/disable printing of debugging info.
*/
private final static boolean DEBUG_MODE = true;
/**
* The minimal number of threads that the tested JVM must support.
* (This number should be specified by the command-line parameter.
*/
private static int MIN_THREADS_EXPECTED = 500;
/**
* Re-invoke to <code>run(args,out)</code> in a JCK style.
*/
public static void main (String args[]) {
int exitCode = run(args,System.out);
System.exit(exitCode + 95);
}
/**
* Entry point for the JavaTest harness: <code>args[0]</code> must
* prescribe the value for the <code>MIN_THREADS_EXPECTED</code> field.
*/
public static int run (String args[], PrintStream out) {
if (args.length > 0)
MIN_THREADS_EXPECTED = Integer.parseInt(args[0]);
if (DEBUG_MODE)
out.println("Trying to start " + MIN_THREADS_EXPECTED + " threads:");
Thread thread[] = new Thread [ MIN_THREADS_EXPECTED ];
int i;
for (i=0; i<MIN_THREADS_EXPECTED; i++)
thread[i] = new thread005();
for (i=0; i<MIN_THREADS_EXPECTED; i++)
try {
// XXX thread[i].setPriority(Thread.MIN_PRIORITY);
thread[i].start();
if (DEBUG_MODE)
out.println("Threads started: " + (i+1));
} catch (OutOfMemoryError itsOK) {
break;
};
if (i < MIN_THREADS_EXPECTED) {
out.println("#");
out.println("# The test have FAILED:");
out.println("# Only " + i + " threads could start,");
out.println("# while at least " + MIN_THREADS_EXPECTED +
" were expected.");
out.println("#");
return 2;
};
GO = true;
if (DEBUG_MODE)
out.println("The test have PASSED.");
return 0;
}
private static boolean STOP = false;
private static boolean GO = false;
/**
* The thread activity: do nothing special, but do not
* free CPU time so that the thread's memory could not
* be moved to swap file.
*/
public void run () {
while (!GO)
yield();
while (!STOP)
continue;
}
}
======================================================================
- relates to
-
JDK-4354056 J2SDK 1.3.0-b26 (Sparc) Server: compiler thread looping against "jck12a004"
- Closed
-
JDK-4326537 Apparent livelock in signal delivery/handling code on Solaris 8
- Closed