Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8315034

File.mkdirs() occasionally fails to create folders on Windows shared folder

    XMLWordPrintable

Details

    • b27
    • windows

    Backports

      Description

        The code below will fail to create the desired folders in the Windows shared folder. It needs to run three processes simultaneously to reproduce the failure scenario quickly.
        The Windows API FindFirestFileW generates the error code ERROR_NO_MORE_FILES for a valid path (possibly due to the compatibility issue with SMB protocol) when JDK is canonicalizing this path. One of the solutions might be to add this error code to https://github.com/openjdk/jdk/blob/master/src/java.base/windows/native/libjava/canonicalize_md.c#L131, which will be treated as a handleable error.

        public static void main(String[] args) {
        String parentFolder = "\\\\192.168.1.96\\temp";
        String folderName="temp";
        int i =0;
        try{
        while(i<10000) {
        File f = new File(parentFolder+"\\"+folderName+args[0]+i+"\\test");
        if(!f.mkdirs()) {
        System.out.println("New folder created==="+i);
        throw new Exception("folder not created");
        }
        i++;
        }
        }catch (Exception e){
        System.out.println(args[0]+" failed at "+i);
        e.printStackTrace();
        }
        }

        Attachments

          Issue Links

            Activity

              People

                wxiao Weibing Xiao
                shadowbug Shadow Bug
                Votes:
                0 Vote for this issue
                Watchers:
                8 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: