Uploaded image for project: 'Apache NiFi'
  1. Apache NiFi
  2. NIFI-3579

Nifi Failed to Start: nio Files.getFileStore(Path) is buggy in Windows

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Critical
    • Resolution: Fixed
    • 1.2.0, 1.1.1
    • 1.2.0
    • Core Framework
    • Win 10 with Oracle JDK 1.8.0_121 on NTFS

    Description

      Nifi is failing to start due to IOException originating from FileSystemRepository during calls to

      Files.getFileStore(path).getTotalSpace();
      Files.getFileStore(path).getUsableSpace();
       

      with a read-access denied status.
      It looks like a buggy JDK implementation as on the other hand the following code is yielding result:

      path.toFile().getTotalSpace();
      path.toFile().getUsableSpace();
      

      Interestingly, the both of the codes are yielding same results for C:\ or System Drive.
      sample

      import java.io.File;
      import java.io.IOException;
      import java.nio.file.Files;
      import java.nio.file.Path;
      import java.nio.file.Paths;
      import java.util.Arrays;
      import static java.lang.System.out;
      public class Blah {
          public static void main(String [] args) throws IOException{
              String [] _paths= {"D:\\workspace\\nifi", "c:\\Program Files"};
              final float divisor=1024 * 1024 * 1024f;
              for(String _path : _paths) {
                  try {
                      Path path = Paths.get(_path);
                      out.println(path.toFile().getTotalSpace() /divisor  + "GB");
                      out.println(Files.getFileStore(path).getTotalSpace()/divisor +"GB");
                  }catch (Exception ex){
                      ex.printStackTrace();
                  }
              }
      
          }
      }
      

      Attachments

        1. nifi-app.log
          108 kB
          Puspendu Banerjee

        Issue Links

          Activity

            People

              puspendu.banerjee@gmail.com Puspendu Banerjee
              puspendu.banerjee@gmail.com Puspendu Banerjee
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: