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

Path length limits on Windows leads to obscure class loading failures

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • P2
    • Resolution: Fixed
    • 9, 10
    • 10
    • hotspot
    • None
    • b34
    • windows
    • Verified

    Description

      As reported in the analysis of JDK-8187884

      Calvin Cheung added a comment - 5 hours ago
      I did more investigation by instrumenting the ClassPathDirEntry::open_stream() in classLoader.cpp
      and found that when it failed, it is due to the jio_snprintf() failed and returning NULL.
        if (jio_snprintf(path, JVM_MAXPATHLEN, "%s%s%s", _dir, os::file_separator(), name) == -1) {
          FREE_RESOURCE_ARRAY(char, path, JVM_MAXPATHLEN);
          return NULL;
        }

      Returning NULL in the above subsequently causes the systemDictionary.cpp throws a CNFE as indicated by David in the above comment.

      jio_snprintf() fails due to the JVM_MAXPATHLEN is too short on windows.

      In jvm_windows.h:

      #define JVM_MAXPATHLEN _MAX_PATH

      According to MSDN, MAX_PATH is defined as 260

      https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx

      ----

      We need to get rid of this small path limitation if possible and also improve the error diagnostics so that it is evident why we are failing to load the class!

      Attachments

        Issue Links

          Activity

            People

              ccheung Calvin Cheung
              dholmes David Holmes
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: