Uploaded image for project: 'Code Tools'
  1. Code Tools
  2. CODETOOLS-7902354

jcstress should remove jcstress*stdout/stderr files

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • None
    • None
    • tools
    • None

      `org.openjdk.jcstress.TestExecutor.VM` creates tmp files by `java.io.File:.createTempFile(String, String, FileAttribute[])`, as there is no code which removes these files and FileAttribute[] is empty (doesn't have DELETE_ON_CLOSE), we left w/ all these files in the tmp dir after test execution.

      suggested fix: use DELETE_ON_CLOSE attr:
      diff -r 0369dc97a8d0 jcstress-core/src/main/java/org/openjdk/jcstress/TestExecutor.java
      --- a/jcstress-core/src/main/java/org/openjdk/jcstress/TestExecutor.java Wed Mar 29 13:30:12 2017 +0200
      +++ b/jcstress-core/src/main/java/org/openjdk/jcstress/TestExecutor.java Thu Dec 13 13:31:27 2018 -0800
      @@ -37,6 +37,7 @@
       import java.io.File;
       import java.io.IOException;
       import java.nio.file.Files;
      +import java.nio.file.StandardOpenOption;
       import java.util.*;
       import java.util.concurrent.*;
       import java.util.concurrent.atomic.AtomicInteger;
      @@ -204,8 +205,8 @@
                   this.pendingTasks = new ArrayList<>(configs);
                   this.firstTask = pendingTasks.get(0);
                   try {
      - this.stdout = File.createTempFile("jcstress", "stdout");
      - this.stderr = File.createTempFile("jcstress", "stderr");
      + this.stdout = File.createTempFile("jcstress", "stdout", StandardOpenOption.DELETE_ON_CLOSE);
      + this.stderr = File.createTempFile("jcstress", "stderr", StandardOpenOption.DELETE_ON_CLOSE);
                   } catch (IOException e) {
                       throw new IllegalStateException(e);
                   }

            shade Aleksey Shipilev
            iignatyev Igor Ignatyev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: