RFR (XS) 8238366: CTW runner closes standard output on exit

Aleksey Shipilev shade at redhat.com
Thu Feb 6 09:37:48 UTC 2020


Bug:
  https://bugs.openjdk.java.net/browse/JDK-8238366

Pretty simple one. When log file is enabled, OUT is the reference to the FileOutputStream, and it
indeed needs closing. But by default OUT is the reference to System.out, and closing it foobars the
output that VM prints on shutdown.

Fix:

diff -r d0ee21ac3329 test/hotspot/jtreg/testlibrary/ctw/src/sun/hotspot/tools/ctw/CompileTheWorld.java
--- a/test/hotspot/jtreg/testlibrary/ctw/src/sun/hotspot/tools/ctw/CompileTheWorld.java Wed Feb 05
03:26:50 2020 +0100
+++ b/test/hotspot/jtreg/testlibrary/ctw/src/sun/hotspot/tools/ctw/CompileTheWorld.java Thu Feb 06
10:15:39 2020 +0100
@@ -97,13 +97,15 @@
                     System.currentTimeMillis() - start));
             passed = true;
         } catch (Throwable t){
             t.printStackTrace(ERR);
         } finally {
-            try {
-                OUT.close();
-            } catch (Throwable ignore) {
+            if (OUT != System.out) {
+                try {
+                    OUT.close();
+                } catch (Throwable ignore) {
+                }
             }
             // <clinit> might have started new threads
             System.exit(passed ? 0 : 1);
         }
     }

Testing: adhoc CTW runs, run-test applications/ctw/modules/

-- 
Thanks,
-Aleksey



More information about the hotspot-compiler-dev mailing list