-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
1.4.0
-
x86
-
windows_2000
Name: elR10090 Date: 12/18/2001
HS 1.4 Client VM crashes at Windows in -Xmixed and -Xcomp
modes while running the test stack016 from the testbase_nsk,
e.g.:
$ javac stack016.java
$ java -Xcomp stack016 ; echo $?
128
[ Exit code=128 means VM crash. ]
Server VM doesn't crash at all platforms with and modes;
as well as Client VM passes the test at all platforms
except of Windows, and at Windows with -Xint mode.
The crash is observed with HS versions 1.4-b66 to 1.4-b89;
while HS versions 1.4-b64 and 1.4-b65 pass but print some
warning message like, e.g.:
$ java -Xcomp stack016 ; echo $?
Maximal recursion depth: 7510
Java HotSpot(TM) Client VM warning: GenCollectedHeap::mem_allocate_work retries 42 times
95
[ Exit code=95 means test "PASS". ]
To reproduce the problem, extract the test stack016 from
this bug-report. Following is the sources for the test:
======================= stack016.java =======================
/* @(#)stack016.java 1.4 01/07/25
* Copyright 07/25/01 Sun Microsystems, Inc.
*/
import java.io.*;
public class stack016 extends Thread {
private final static int THREADS = 10;
private final static int CYCLES = 10;
private final static int STEP = 10;
private final static int RESERVE = 10;
private final static int PROBES = STEP * RESERVE;
public static void main(String[] args) {
int exitCode = run(args,System.out);
System.exit(exitCode + 95);
}
public static int run (String args[], PrintStream out) {
verbose = false;
if (args.length > 0) {
if (args[0].toLowerCase().startsWith("-v"))
verbose = true;
};
stack016.out = out;
stack016 test = new stack016();
return test.doRun();
}
private static boolean verbose;
private static PrintStream out;
private void display(Object message) {
if (!verbose)
return;
synchronized (out) {
out.println(message.toString());
};
}
private int doRun() {
//
// Measure recursive depth before stack overflow:
//
int maxDepth = 0;
for (depthToTry=0; ; depthToTry+=STEP)
try {
trickyRecurse(depthToTry);
maxDepth = depthToTry;
} catch (Error error) {
break;
};
out.println("Maximal recursion depth: " + maxDepth);
//
// Run the tested threads:
//
stack016 threads[] = new stack016 [ THREADS ];
for (int i=0; i<threads.length; i++) {
threads[i] = new stack016();
threads[i].setName("Thread: " + (i+1) + "/" + THREADS);
threads[i].depthToTry = RESERVE * maxDepth;
threads[i].start();
};
for (int i=0; i<threads.length; i++)
if (threads[i].isAlive())
try {
threads[i].join();
} catch (InterruptedException exception) {
exception.printStackTrace(out);
return 2;
};
//
// Check if unexpected exceptions were thrown:
//
int exitCode = 0;
for (int i=0; i<threads.length; i++)
if (threads[i].thrown != null) {
threads[i].thrown.printStackTrace(out);
exitCode = 2;
};
if (exitCode != 0)
out.println("# TEST FAILED");
return exitCode;
}
private int stackTop = 0;
private int depthToTry = 0;
private Throwable thrown = null;
private void trickyRecurse(int depth) {
stackTop = depthToTry - depth;
if (depth > 0)
try {
trickyRecurse(depth - 1);
} catch (Error error) {
if (!(error instanceof StackOverflowError) &&
!(error instanceof OutOfMemoryError))
throw error;
//
// Provoke more stack overflow,
// if current stack is deep enough:
//
if (depthToTry-depth < stackTop-PROBES)
throw error;
recurse(depthToTry);
throw new Error("TEST_RFE: try deeper recursion!");
};
}
private static void recurse(int depth) {
if (depth > 0)
recurse(depth - 1);
}
public void run() {
String threadName = Thread.currentThread().getName();
for (int i=1; i<=CYCLES; i++)
try {
display(threadName + ", iteration: " + i + "/" + CYCLES);
trickyRecurse(depthToTry);
throw new Error(
"TEST_BUG: trickyRecursion() must throw an error anyway!");
} catch (StackOverflowError error) {
// It's OK: stack overflow was expected.
} catch (OutOfMemoryError oome) {
// Also OK, if there is no memory for stack expansion.
} catch (Throwable throwable) {
if (throwable instanceof ThreadDeath)
throw (ThreadDeath)throwable;
thrown = throwable;
break;
};
}
}
======================= EOF =======================
Here is the full list of testbase_nsk tests catching this bug:
nsk/stress/stack/stack002
nsk/stress/stack/stack016
Also, see the bugs:
4457254 nsk/stress/stack/stack008 crashes with assertion at codeCache.cpp, 198
4463493 nsk/stress/stack/stack001 test crashes with assertion at sharedRuntime.cpp, 222
4468289 nsk/stress/stack/stack015 test crashes with assertion at synchronizer.cpp, 192
======================================================================
- duplicates
-
JDK-4502373 client VM doesn't throw expected java.lang.StackOverflowError on windows_XP
- Closed
- relates to
-
JDK-4457254 nsk/stress/stack/stack008 crashes with assertion at codeCache.cpp, 198
- Closed
-
JDK-4463493 nsk/stress/stack/stack001 test crashes with assertion at sharedRuntime.cpp, 222
- Closed