JDK-4678676 : Reg-test ReflectStackOverflow.java Failing
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 1.4.1
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: linux
  • CPU: x86
  • Submitted: 2002-05-02
  • Updated: 2003-02-19
  • Resolved: 2002-12-17
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
1.4.2 b11Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Description

Name: as83306			Date: 05/02/2002

Regression test vm/misc/ReflectStackOverflow.java fails with Hopper build 10 on SuSe Linux 7.1, host-seahund, 
desktop-KDE and hotspot-server.  This test has failed in the past and closed as "not a bug".  The test continues to fail.  Being that 
the stack size is between 2 and 8 megs, it's understandable that the test would time-out before the test hits stack overflow.  
However, as long as this test fails with a time-out, this feature is never actually tested. This test should either be modified to 
work within the realistic system environments or removed from the test suite if it's not applicable or practical.
 
 For test hardware config's, see http://sqesvr.eng/st3/jdk1.4/docs/Merlin-hw.html
#Test Results (version 2)
#Wed Apr 24 02:43:04 PDT 2002
#checksum:41bc4e290b27b520
#-----testdescription-----
$file=/export0/regression/jdk1.4.1Tests/b10/vm/misc/ReflectStackOverflow.java
$root=/export0/regression/jdk1.4.1Tests/b10
keywords=bug4185411 othervm
run=USER_SPECIFIED main/othervm ReflectStackOverflow\n
source=ReflectStackOverflow.java
title=This program crashes in 1.1, but runs okay in 1.2.

#-----environment-----

#-----testresult-----
description=file:///export0/regression/jdk1.4.1Tests/b10/vm/misc/ReflectStackOverflow.java
end=Wed Apr 24 02:43:04 PDT 2002
environment=regtest
execStatus=Failed. Execution failed: `main' threw exception: java.lang.OutOfMemoryError
javatestOS=Linux 2.2.18 (i386)
javatestVersion=2.1.5
script=com.sun.javatest.regtest.RegressionScript 
sections=script_messages build compile main
start=Wed Apr 24 02:42:05 PDT 2002
status=Failed. Execution failed: `main' threw exception: java.lang.OutOfMemoryError
test=vm/misc/ReflectStackOverflow.java
work=/export0/results/regression/hopper/b10/seahund2.2.18-jthb10-jdk141b10.04-23.20.13-ALL/vm/misc

#section:script_messages
----------messages:(4/202)----------
JDK under test: (/export0/java/jdk141b10)
java version "1.4.1-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-beta-b10)
Java HotSpot(TM) Client VM (build 1.4.1-beta-b10, mixed mode)

#section:build
----------messages:(3/106)----------
command: build ReflectStackOverflow 
reason: Named class compiled on demand
elapsed time (seconds): 2.937
result: Passed. Compilation successful

#section:compile
----------messages:(3/170)----------
command: compile /export0/regression/jdk1.4.1Tests/b10/vm/misc/ReflectStackOverflow.java 
reason: .class file out of date or does not exist
elapsed time (seconds): 2.917
----------System.out:(0/0)----------
----------System.err:(0/0)----------
result: Passed. Compilation successful

#section:main
----------messages:(3/136)----------
command: main ReflectStackOverflow
reason: User specified action: run main/othervm ReflectStackOverflow 
elapsed time (seconds): 56.686
----------System.out:(0/0)----------
----------System.err:(7/229)----------
Found 7108 layers of wrappers.
java.lang.OutOfMemoryError

JavaTest Message: Test threw exception: java.lang.OutOfMemoryError
JavaTest Message: shutting down test

STATUS:Failed.`main' threw exception: java.lang.OutOfMemoryError
result: Failed. Execution failed: `main' threw exception: java.lang.OutOfMemoryError


test result: Failed. Execution failed: `main' threw exception: java.lang.OutOfMemoryError
======================================================================

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: mantis-beta FIXED IN: mantis-beta INTEGRATED IN: mantis-b11 mantis-beta VERIFIED IN: mantis-beta
14-06-2004

SUGGESTED FIX os_linux.cpp: 394c376 < void os::Linux::capture_initial_stack(size_t max_size) { --- > void os::Linux::capture_initial_stack(void) { 443,446d424 < if (max_size && _initial_thread_stack_size > max_size) { < _initial_thread_stack_size = max_size; < } < 1717a1696,1697 > Linux::capture_initial_stack(); > 1756,1757d1735 < < Linux::capture_initial_stack(JavaThread::stack_size_at_create()); -------------------------------------------------------- os_linux.hpp: 92c92 < static void capture_initial_stack(size_t max_size); --- > static void capture_initial_stack(void); -------------------------------------------------------- More changes in test/vm/misc/ReflectStackOverflow.java to limit stack size to -Xss512k: *** 1,9 **** /* @test @bug 4185411 @summary This program crashes in 1.1, but runs okay in 1.2. ! @run main/othervm ReflectStackOverflow */ import java.lang.reflect.*; public class ReflectStackOverflow { private static final int COUNT = 11000; --- 1,9 ---- /* @test @bug 4185411 @summary This program crashes in 1.1, but runs okay in 1.2. ! @run main/othervm -Xss512k ReflectStackOverflow */ import java.lang.reflect.*; public class ReflectStackOverflow { private static final int COUNT = 11000;
11-06-2004

PUBLIC COMMENTS .
10-06-2004

EVALUATION Please see also bug 4456826. -Xss is supported on Linux except for the first thread, as it's not created by the pthread library. I checked Solaris version and noticed that -Xss is honored by the program's main thread. We can mimic that behavior on Linux - and this test will finish sooner. Note this is not a real failure, but the testcase needs more time to run, because main thread's default stack is much deeper on Linux than on Solaris, so there are more layers of Method.invoke() wrappers. ###@###.### 2002-05-16 ---------------------------------------------- Please see suggested fix. We can "adjust" the stack size of a program's primordial thread by putting the guard pages closer to the stack top, We only do this if: + user specified stack size (e.g. -Xss), and + it's smaller than the "ulimit -s" value Note if no stack size is specified when VM is launched, we will still pick up the default size used by the kernel (i.e. ulimit -s). It doesn't make much sense to artificially limit stack size when kernel has already reserved enough space for the stack, and that might break existing application too. For this test to finish quickly, you need to pass a smaller -Xss value. For example, "java -Xss256k ReflectStackOverflow" can finish within 3 sec on my desktop. ###@###.### 2002-09-26 ----------------------------------------------- The test still fails on SuSE 7.1 with 2.4 kernel on an OutOfMemoryError. So the bug is reopened. The test passes on Redhat or SuSE 8. > ----------System.err:(7/229)---------- > Found 6970 layers of wrappers. > java.lang.OutOfMemoryError > > JavaTest Message: Test threw exception: java.lang.OutOfMemoryError > JavaTest Message: shutting down test > > STATUS:Failed.`main' threw exception: java.lang.OutOfMemoryError > result: Failed. Execution failed: `main' threw exception: java.lang.OutOfMemoryError > > test result: Failed. Execution failed: `main' threw exception: java.lang.OutOfMemoryError Note every layer of the wrapper represents one of the nesting Method.invoke() calls and it should contain the stack trace for the invocation. So the memory usage could easily be O(n^2) depending on the stack size. It could be we just run out of memory. ###@###.### 2002-11-20 ------------------------------------------------- ###@###.### suggested to modify the testcase and specify -Xss in the @run tag (the test harness can pick up VM options from @run tag), see "Suggested Fix" for the change. Anyway, this change is now in the TL workspace, and should be included in 1.4.2-b11. ###@###.### 2002-12-11
11-12-2002