2
* Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation.
9
* This code is distributed in the hope that it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12
* version 2 for more details (a copy is included in the LICENSE file that
13
* accompanied this code).
15
* You should have received a copy of the GNU General Public License version
16
* 2 along with this work; if not, write to the Free Software Foundation,
17
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20
* or visit www.oracle.com if you need additional information or have any
28
* @summary converted from VM testbase nsk/stress/stack/stack001.
29
* VM testbase keywords: [stress, quick, stack, nonconcurrent]
32
* Provoke StackOverflowError by infinite recursion in Java method,
33
* intercept the exception try to make one more invocation.
35
* Kestrel for Solaris_JDK_1.3-b10 crashes while trying to execute
36
* this test with Client HS VM.
37
* See lots of bugs concerning similar failures:
39
* 4217960 [native stack overflow bug] reflection test causes crash
41
* 4285716 native stack overflow causes crash on Solaris
42
* 4281578 Second stack overflow crashes HotSpot VM
44
* 4027933 Native stack overflows not detected or handled correctly
45
* 4134353 (hpi) sysThreadCheckStack is a no-op on win32
46
* 4185411 Various crashes when using recursive reflection.
47
* 4167055 infinite recursion in FindClass
48
* 4222359 Infinite recursion crashes jvm
49
* Closed (will not fix):
50
* 4231968 StackOverflowError in a native method causes Segmentation Fault
51
* 4254634 println() while catching StackOverflowError causes hotspot VM crash
52
* 4302288 the second stack overflow causes Classic VM to exit on win32
54
* @requires vm.opt.DeoptimizeALot != true
55
* @run main/othervm/timeout=900 Stack001
58
public class Stack001 {
59
public static void main(String[] args) {
60
Stack001 test = new Stack001();
62
System.out.println("Maximal depth: " + test.maxdepth);
67
private void recurse(int depth) {
71
} catch (StackOverflowError | OutOfMemoryError e) {
72
if (maxdepth == depth) {