Harmony
  1. Harmony
  2. HARMONY-2270

[classlib][unit] tests.api.java.io.FileTest@test_mkdir failes on win XP

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Classlib
    • Labels:
      None
    • Environment:
      win XP

      Description

      tests.api.java.io.FileTest@test_mkdir failes on win XP:

      mkdir 257 failed
      junit.framework.AssertionFailedError: mkdir 257 failed at tests.api.java.io.FileTest.test_mkdir(FileTest.java:1811) at java.lang.reflect.VMReflection.invokeMethod(Native Method)

      To get more information run stand alone test:

      import java.io.*;
      public class Test2 {
      public static void main(String[] args) throws IOException {
      // Test for method boolean java.io.File.mkdir()
      String base = System.getProperty("user.dir");
      int dirNumber = 1;
      boolean dirExists = true;
      File dir = new File(base, String.valueOf(dirNumber));
      while (dirExists) {
      if (dir.exists())

      { dirNumber++; dir = new File(base, String.valueOf(dirNumber)); }

      else

      { dirExists = false; }

      }
      if (!dir.mkdir() && dir.exists()) System.out.println("mkdir failed");
      else System.out.println("PASSED_1");

      dir.deleteOnExit();

      StringBuilder sb = new StringBuilder(dir + File.separator);
      while (dir.getCanonicalPath().length() < 256)

      { sb.append(0); dir = new File(sb.toString()); if (!dir.mkdir() && dir.exists()) System.out.println("mkdir " + dir.getCanonicalPath().length() + " failed"); else System.out.println("PASSED_2"); dir.deleteOnExit(); }

      }
      }

      $ /cygdrive/<path to jre>/win_ia32_msvc_debug/deploy/jre/bin/java Test2 -showversion
      PASSED_1
      PASSED_2
      ...........
      PASSED_2
      PASSED_2

      An unhandled error (4) has occurred.
      HyGeneric_Signal_Number=00000004
      ExceptionCode=c0000005
      ExceptionAddress=7C911E5A
      ContextFlags=0001003f
      Handler1=00401010
      Handler2=11105D80
      InaccessibleAddress=00000004
      EDI=00164B58
      ESI=001634B0
      EAX=001634B8
      EBX=00150000
      ECX=001634CC
      EDX=00000000
      EIP=7C911E5A
      ESP=0013F638
      EBP=0013F644
      Module=C:\WINDOWS\system32\ntdll.dll
      Module_base_address=7C900000
      Offset_in_DLL=00011e5a

      This application has requested the Runtime to terminate it in an unusual way.
      Please contact the application's support team for more information.
      $

      The debug shows the problem is in nt_exception_filter.cpp

      While iterative run of luni module with -Dhy.test.forkmode=perTest tests.api.java.io.FileTest@test_mkdir fails 50 times out of 50.
      The stand alone code fails from time to time on win XP

      1. harmony-2270-28Nov.diff
        2 kB
        Tony Wu
      2. harmony-2270-test.diff
        1 kB
        Tony Wu
      3. harmony-2270.diff
        0.7 kB
        Tony Wu

        Issue Links

          Activity

          Hide
          Vladimir Ivanov added a comment -

          For me this test failed with message: "mkdir 248 failed" for IBM VM

          If I try to create this directory by 'mkdir' utility it reports: "Invalid argument" while directory with 247 symbols create OK.

          Show
          Vladimir Ivanov added a comment - For me this test failed with message: "mkdir 248 failed" for IBM VM If I try to create this directory by 'mkdir' utility it reports: "Invalid argument" while directory with 247 symbols create OK.
          Hide
          Tony Wu added a comment -

          Hi, I revert my previous patch(2157) and it passed. I'll follow this bug, Thanks for pointing out it.

          Show
          Tony Wu added a comment - Hi, I revert my previous patch(2157) and it passed. I'll follow this bug, Thanks for pointing out it.
          Hide
          Tony Wu added a comment -

          patch & test, would you please try it. Thank you all!

          Show
          Tony Wu added a comment - patch & test, would you please try it. Thank you all!
          Hide
          Vladimir Ivanov added a comment -

          Seems, thei patch does not help me.
          With some output before & after createDir() (line 360 and 363):
          [junit] Tests run: 47, Failures: 1, Errors: 0, Time elapsed: 5.738 sec
          [junit] canon.path = \\?\C:\harmonytop\classlib\trunk\modules\luni\1\abcdefghijklmnopqrstuvwx\abcdefghijklmnopqrstuvwx\abcdefghijklmnopqrstuvwx\ab
          cdefghijklmnopqrstuvwx\abcdefghijklmnopqrstuvwx\abcdefghijklmnopqrstuvwx\abcdefghijklmnopqrstuvwx\abcdefghijklmnopqrstuvwx\000
          [junit] result is false
          [junit] 3
          [junit] Test tests.api.java.io.FileTest FAILED

          The result of dir creation is 3.

          Show
          Vladimir Ivanov added a comment - Seems, thei patch does not help me. With some output before & after createDir() (line 360 and 363): [junit] Tests run: 47, Failures: 1, Errors: 0, Time elapsed: 5.738 sec [junit] canon.path = \\?\C:\harmonytop\classlib\trunk\modules\luni\1\abcdefghijklmnopqrstuvwx\abcdefghijklmnopqrstuvwx\abcdefghijklmnopqrstuvwx\ab cdefghijklmnopqrstuvwx\abcdefghijklmnopqrstuvwx\abcdefghijklmnopqrstuvwx\abcdefghijklmnopqrstuvwx\abcdefghijklmnopqrstuvwx\000 [junit] result is false [junit] 3 [junit] Test tests.api.java.io.FileTest FAILED The result of dir creation is 3.
          Hide
          Tony Wu added a comment -

          Hi Vladimir,
          would you please show me which line of testcase failed and which VME you used? All the tests passed on my machine with IBM VME, so It's hard for me to reproduce it now...Thanks

          Show
          Tony Wu added a comment - Hi Vladimir, would you please show me which line of testcase failed and which VME you used? All the tests passed on my machine with IBM VME, so It's hard for me to reproduce it now...Thanks
          Hide
          Tony Wu added a comment -

          And I think you should apply the patch and then "ant -Dbuild.module=portlib" to get native code compiled, or the patch does nothing for you.

          Show
          Tony Wu added a comment - And I think you should apply the patch and then "ant -Dbuild.module=portlib" to get native code compiled, or the patch does nothing for you.
          Hide
          Paulex Yang added a comment -

          This issue is caused by the incompleted patch of HARMONY-2157.

          Show
          Paulex Yang added a comment - This issue is caused by the incompleted patch of HARMONY-2157 .
          Hide
          Paulex Yang added a comment -

          Vladimir, yes, this patch fixes the VM crash of Tatyana's test case above, but has no effect on the tests introduced by HARMONY-2157. The latter one always passes on my WinXP SP2 thinkpad. Would you please check that your portlib is updated and built into jdk/jre/bin/hyprt.dll? Thank you.

          Show
          Paulex Yang added a comment - Vladimir, yes, this patch fixes the VM crash of Tatyana's test case above, but has no effect on the tests introduced by HARMONY-2157 . The latter one always passes on my WinXP SP2 thinkpad. Would you please check that your portlib is updated and built into jdk/jre/bin/hyprt.dll? Thank you.
          Hide
          Paulex Yang added a comment -

          Tony, the patch and test applied at revision r479653 and r479656, respectively, please verify, thanks for this enhancement.

          Tatyana and Vladimir, with Tony's patch, both tests from HARMONY-2157 and this issue can pass on my WinXP SP2 workstation, please verify whether this patch works for you, thank you very much.

          Show
          Paulex Yang added a comment - Tony, the patch and test applied at revision r479653 and r479656, respectively, please verify, thanks for this enhancement. Tatyana and Vladimir, with Tony's patch, both tests from HARMONY-2157 and this issue can pass on my WinXP SP2 workstation, please verify whether this patch works for you, thank you very much.
          Hide
          Vladimir Ivanov added a comment -

          On my WinXP SP2 the second test for H-2157 is failed (I run luni -Dtest.case=tests.api.java.io.FileTest) with message:
          "mkdir 248 failed
          junit.framework.AssertionFailedError: mkdir 248 failed at tests.api.java.io.FileTest.test_mkdir(FileTest.java:1811) at java.lang.reflect.AccessibleObject.invokeV(AccessibleObject.java:25)"

          It is reproduced for me on the classlib r479866+IBM VM.

          Note, sometimes it failed as:
          -------------------------------------------------------
          C:\tmp\tmp17>C:\harmony.top\classlib\trunk\deploy\jdk\jre\bin\java.exe -cp . test
          mkdir 239 OK
          mkdir 240 OK
          mkdir 241 OK
          mkdir 242 OK
          mkdir 243 OK
          mkdir 244 OK
          mkdir 245 OK
          mkdir 246 OK
          mkdir 247 OK
          mkdir 248 OK
          mkdir 249 OK
          mkdir 250 OK
          mkdir 251 OK
          mkdir 252 OK
          mkdir 253 OK
          mkdir 254 OK
          mkdir 255 OK
          mkdir 256 OK

          An unhandled error (4) has occurred.
          HyGeneric_Signal_Number=00000004
          ExceptionCode=c0000005
          ExceptionAddress=7C910F29
          ContextFlags=0001003f
          Handler1=00401010
          Handler2=11105D80
          InaccessibleAddress=00000000
          EDI=016A5BF0
          ESI=016A7090
          EAX=016A7098
          EBX=00150000
          ECX=00000000
          EDX=00000000
          EIP=7C910F29
          ESP=0013F854
          EBP=0013F860
          Module=C:\WINNT\system32\ntdll.dll
          Module_base_address=7C900000
          Offset_in_DLL=00010f29

          This application has requested the Runtime to terminate it in an unusual way.
          Please contact the application's support team for more information.

          C:\tmp\tmp17>C:\harmony.top\drlvm\trunk\build\win_ia32_msvc_debug\deploy\jre\bin\java -Dvm.assert_dialog=false -cp . -showversion test
          Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors, as applicable.
          java version "1.5.0"
          pre-alpha : not complete or compatible
          svn = r479866, (Nov 28 2006), Windows/ia32/msvc 1310, debug build
          http://incubator.apache.org/harmony
          mkdir 239 OK
          mkdir 240 OK
          mkdir 241 OK
          mkdir 242 OK
          mkdir 243 OK
          mkdir 244 OK
          mkdir 245 OK
          mkdir 246 OK
          mkdir 247 OK
          mkdir 248 OK
          mkdir 249 OK
          mkdir 250 OK
          mkdir 251 OK
          mkdir 252 OK
          mkdir 253 OK
          mkdir 254 OK
          mkdir 255 OK
          mkdir 256 OK

          C:\tmp\tmp17>exit

          -------------------------------------------------------
          Standalone test (test.java):

          import java.io.*;

          public class test {
          public static void main (String[] args) throws Exception {
          File dir = new File(".");
          String longDirName = "abcdefghijklmnopqrstuvwx";// 24 chars
          StringBuilder sb = new StringBuilder(dir + File.separator);
          while (dir.getCanonicalPath().length() < 256 - longDirName.length()) {
          sb.append(longDirName + File.separator);
          dir = new File(sb.toString());
          dir.deleteOnExit();
          if (!(dir.mkdir() && dir.exists()))

          { System.out.println("mkdir failed"); }


          }
          while (dir.getCanonicalPath().length() < 256) {
          sb.append(0);
          dir = new File(sb.toString());
          dir.deleteOnExit();
          if (!(dir.mkdir() && dir.exists()))

          { System.out.println("mkdir " + dir.getCanonicalPath().length() + " failed"); }

          else

          { System.out.println("mkdir " + dir.getCanonicalPath().length() + " OK"); }

          }
          }
          }
          -----------------------------------------

          Show
          Vladimir Ivanov added a comment - On my WinXP SP2 the second test for H-2157 is failed (I run luni -Dtest.case=tests.api.java.io.FileTest) with message: "mkdir 248 failed junit.framework.AssertionFailedError: mkdir 248 failed at tests.api.java.io.FileTest.test_mkdir(FileTest.java:1811) at java.lang.reflect.AccessibleObject.invokeV(AccessibleObject.java:25)" It is reproduced for me on the classlib r479866+IBM VM. Note, sometimes it failed as: ------------------------------------------------------- C:\tmp\tmp17>C:\harmony.top\classlib\trunk\deploy\jdk\jre\bin\java.exe -cp . test mkdir 239 OK mkdir 240 OK mkdir 241 OK mkdir 242 OK mkdir 243 OK mkdir 244 OK mkdir 245 OK mkdir 246 OK mkdir 247 OK mkdir 248 OK mkdir 249 OK mkdir 250 OK mkdir 251 OK mkdir 252 OK mkdir 253 OK mkdir 254 OK mkdir 255 OK mkdir 256 OK An unhandled error (4) has occurred. HyGeneric_Signal_Number=00000004 ExceptionCode=c0000005 ExceptionAddress=7C910F29 ContextFlags=0001003f Handler1=00401010 Handler2=11105D80 InaccessibleAddress=00000000 EDI=016A5BF0 ESI=016A7090 EAX=016A7098 EBX=00150000 ECX=00000000 EDX=00000000 EIP=7C910F29 ESP=0013F854 EBP=0013F860 Module=C:\WINNT\system32\ntdll.dll Module_base_address=7C900000 Offset_in_DLL=00010f29 This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information. C:\tmp\tmp17>C:\harmony.top\drlvm\trunk\build\win_ia32_msvc_debug\deploy\jre\bin\java -Dvm.assert_dialog=false -cp . -showversion test Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors, as applicable. java version "1.5.0" pre-alpha : not complete or compatible svn = r479866, (Nov 28 2006), Windows/ia32/msvc 1310, debug build http://incubator.apache.org/harmony mkdir 239 OK mkdir 240 OK mkdir 241 OK mkdir 242 OK mkdir 243 OK mkdir 244 OK mkdir 245 OK mkdir 246 OK mkdir 247 OK mkdir 248 OK mkdir 249 OK mkdir 250 OK mkdir 251 OK mkdir 252 OK mkdir 253 OK mkdir 254 OK mkdir 255 OK mkdir 256 OK C:\tmp\tmp17>exit ------------------------------------------------------- Standalone test (test.java): import java.io.*; public class test { public static void main (String[] args) throws Exception { File dir = new File("."); String longDirName = "abcdefghijklmnopqrstuvwx";// 24 chars StringBuilder sb = new StringBuilder(dir + File.separator); while (dir.getCanonicalPath().length() < 256 - longDirName.length()) { sb.append(longDirName + File.separator); dir = new File(sb.toString()); dir.deleteOnExit(); if (!(dir.mkdir() && dir.exists())) { System.out.println("mkdir failed"); } } while (dir.getCanonicalPath().length() < 256) { sb.append(0); dir = new File(sb.toString()); dir.deleteOnExit(); if (!(dir.mkdir() && dir.exists())) { System.out.println("mkdir " + dir.getCanonicalPath().length() + " failed"); } else { System.out.println("mkdir " + dir.getCanonicalPath().length() + " OK"); } } } } -----------------------------------------
          Hide
          Tony Wu added a comment -

          Hi Vladimir,
          Seems, it was caused by a C pointer which moved beyond its range sometime. Would you please help to check the new patch, it passed on both IBM VME and lateset DRLVM on my machine.
          Thanks for your information

          Show
          Tony Wu added a comment - Hi Vladimir, Seems, it was caused by a C pointer which moved beyond its range sometime. Would you please help to check the new patch, it passed on both IBM VME and lateset DRLVM on my machine. Thanks for your information
          Hide
          Vladimir Ivanov added a comment -

          The last patch is OK for me.
          Thanks, Vladimir

          Show
          Vladimir Ivanov added a comment - The last patch is OK for me. Thanks, Vladimir
          Hide
          Paulex Yang added a comment -

          Tony, I think the new patch still has some problems, for example, the memory allocated for *slash may be leaked, and some invalid directory name may still cause VM crash.

          I've reverted the original patch with HARMONY-2157's at revision r480075.

          Show
          Paulex Yang added a comment - Tony, I think the new patch still has some problems, for example, the memory allocated for *slash may be leaked, and some invalid directory name may still cause VM crash. I've reverted the original patch with HARMONY-2157 's at revision r480075.
          Hide
          Paulex Yang added a comment -

          Seems it cannot reproduce after HARMONY-2157 is fixed.

          Tatyana, would you please to verify?

          Show
          Paulex Yang added a comment - Seems it cannot reproduce after HARMONY-2157 is fixed. Tatyana, would you please to verify?

            People

            • Assignee:
              Paulex Yang
              Reporter:
              tatyana doubtsova
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development