Details

    • Type: Bug
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: tools
    • Labels:
    • Subcomponent:
    • CPU:
      generic
    • OS:
      windows

      Description

      On Windows, in samevm mode, the cleanup of files in the scratch directory may fail because the files are still open.
      Closing of FileInputStream and FileOutputStreams (that are not closed explicitly) are handled by either finalization or the Cleaner. Both are dependent on the running of System.gc().
      Invoking System.gc as part of the cleanup will close streams and allow the files to be deleted.

        Issue Links

          Activity

          Hide
          rriggs Roger Riggs added a comment -
          The error appeared only jprt jobs and I noticed they were run using main/agentvm.
          I tried that locally and found that the .jtr file had bad ownership and attributes:

          -rw-r----- 1 Unknown+User Unknown+Group 17659 Oct 4 10:10 JTwork/java/nio/channels/FileChannel/directio/PreadDirect.jtr

          I was unable to change the ownership or attributes to make it readable.
          Show
          rriggs Roger Riggs added a comment - The error appeared only jprt jobs and I noticed they were run using main/agentvm. I tried that locally and found that the .jtr file had bad ownership and attributes: -rw-r----- 1 Unknown+User Unknown+Group 17659 Oct 4 10:10 JTwork/java/nio/channels/FileChannel/directio/PreadDirect.jtr I was unable to change the ownership or attributes to make it readable.
          Hide
          jjg Jonathan Gibbons added a comment -
          [~rriggs]
          I'm trying to understand what's going on here.

          1. Are you saying this is a repeatable fault on both JPRT and your local machine?

          2. I don't understand how jtreg could even generate a .jtr file locally with Unknown+User Unknown+Group. Something external to jtreg (such as a Makefile) would have to be doing something "weird".

          3. The jtreg message "test result: Error. failed to clean up files after test" is supposed to just refer to handling files in the scratch directory, in which case I note the original suggestion to have jtreg call System.gc. The message is not supposed to be used if there is a problem (IOException) writing the .jtr file. If the repeatable problem here is problems with the .jtr file for some reason, then a reasonable Enhancement Request for jtreg would be to improve the relevance of the error message.
          Show
          jjg Jonathan Gibbons added a comment - [~rriggs] I'm trying to understand what's going on here. 1. Are you saying this is a repeatable fault on both JPRT and your local machine? 2. I don't understand how jtreg could even generate a .jtr file locally with Unknown+User Unknown+Group. Something external to jtreg (such as a Makefile) would have to be doing something "weird". 3. The jtreg message "test result: Error. failed to clean up files after test" is supposed to just refer to handling files in the scratch directory, in which case I note the original suggestion to have jtreg call System.gc. The message is not supposed to be used if there is a problem (IOException) writing the .jtr file. If the repeatable problem here is problems with the .jtr file for some reason, then a reasonable Enhancement Request for jtreg would be to improve the relevance of the error message.
          Hide
          rriggs Roger Riggs added a comment -
          Still working to isolate and diagnose.

          1. It is repeatable that in JPRT the cleanup fails. (Not reproducible locally)
             I'm still looking for what is different in JPRT (agentvm mode perhaps)

          2. Right, weird and not reproducible

          3. The message does not indicate which files it could not cleanup;
              In a specific test case, it was known that a FileInputStream was left open.
              Some of the code under test is modifying the code to handle closing of handles
              and affecting the jtreg behavior. When run in samevm mode it may affect jtreg too.

          Switching to @ run main/othervm seemed to avoid the failed to cleanup symptom.

          After failed runs, some files could not be deleted by the command line and were flagged in-use.

          I'll update when I can isolate better.
          Show
          rriggs Roger Riggs added a comment - Still working to isolate and diagnose. 1. It is repeatable that in JPRT the cleanup fails. (Not reproducible locally)    I'm still looking for what is different in JPRT (agentvm mode perhaps) 2. Right, weird and not reproducible 3. The message does not indicate which files it could not cleanup;     In a specific test case, it was known that a FileInputStream was left open.     Some of the code under test is modifying the code to handle closing of handles     and affecting the jtreg behavior. When run in samevm mode it may affect jtreg too. Switching to @ run main/othervm seemed to avoid the failed to cleanup symptom. After failed runs, some files could not be deleted by the command line and were flagged in-use. I'll update when I can isolate better.
          Hide
          jjg Jonathan Gibbons added a comment -
          It's not really a surprise that switching to othervm mode fixes problems like this.

          I've added, with a comment, a call to System.gc() at the appropriate place in the cleanup code.
          I'll be pushing that changeset shortly.
          Show
          jjg Jonathan Gibbons added a comment - It's not really a surprise that switching to othervm mode fixes problems like this. I've added, with a comment, a call to System.gc() at the appropriate place in the cleanup code. I'll be pushing that changeset shortly.
          Hide
          jjg Jonathan Gibbons added a comment -
          The jtreg message "test result: Error. failed to clean up files after test" is a summary message at the end of the test run. There should be more specific messages in the .jtr file itself.
          Show
          jjg Jonathan Gibbons added a comment - The jtreg message "test result: Error. failed to clean up files after test" is a summary message at the end of the test run. There should be more specific messages in the .jtr file itself.
          Hide
          jjg Jonathan Gibbons added a comment -
          I've added the System.gc() call in
          http://hg.openjdk.java.net/code-tools/jtreg/rev/9c928f68b0e6

          but there is still no explanation for the "weird" behavior, including " Unknown+User Unknown+Group" described earlier, so I'll leave the issue open for now.
          Show
          jjg Jonathan Gibbons added a comment - I've added the System.gc() call in http://hg.openjdk.java.net/code-tools/jtreg/rev/9c928f68b0e6 but there is still no explanation for the "weird" behavior, including " Unknown+User Unknown+Group" described earlier, so I'll leave the issue open for now.

            People

            • Assignee:
              Unassigned
              Reporter:
              rriggs Roger Riggs
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated: