changeset 52571:05b05af6c160

8210237: [TESTBUG]gc/stress/TestStressIHOPMultiThread.java fails with 'Unexpected exit from test [exit code: 1]' in CDS mode Summary: Fix TestStressIHOPMultiThread to handle possible OutOfMemoryError. Reviewed-by: ccheung, gziemski
author jiangli
date Tue, 18 Sep 2018 11:55:33 -0400
parents fbec908e2783
children c93f14a4ae29
files test/hotspot/jtreg/gc/stress/TestStressIHOPMultiThread.java
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/test/hotspot/jtreg/gc/stress/TestStressIHOPMultiThread.java	Tue Sep 18 08:27:01 2018 -0400
+++ b/test/hotspot/jtreg/gc/stress/TestStressIHOPMultiThread.java	Tue Sep 18 11:55:33 2018 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -181,7 +181,13 @@
         public void run() {
             System.out.println("Start the thread " + threadId);
             while (TestStressIHOPMultiThread.this.isRunning()) {
-                allocate(amountOfGarbage);
+                try {
+                    allocate(amountOfGarbage);
+                } catch (OutOfMemoryError e) {
+                    free();
+                    System.out.println("OutOfMemoryError occurred in thread " + threadId);
+                    break;
+                }
                 free();
             }
         }