Uploaded image for project: 'Maven Surefire'
  1. Maven Surefire
  2. SUREFIRE-1376

"The forked VM terminated without properly saying goodbye" when running Surefire in a very deep project structure on Windows

    XMLWordPrintableJSON

Details

    Description

      When Surefire is ran on a project under a very long path (exceeding Windows' MAX_PATH), the invocation fails with

      org.apache.maven.surefire.booter.SurefireBooterForkException: The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
      

      In the generated dumpstream, there is

      # Created on 2017-05-28T10:17:09.474
      Error: Unable to access jarfile C:\Users\Guillaume\Desktop\surefire-longpath-test-with-windows\surefire-longpath-test-with-windows\surefire-longpath-test-with-windows\surefire-longpath-test-with-windows\surefire-longpath-test-with-windows\surefire-longpath-test-with-windows\target\surefire\surefirebooter2512478076549179739.jar
      

      The problem is that the path to the JAR file exceeds the maximum path length of 260 characters, and so it cannot be accessed.

      Prepending the path to the JAR file with \\?\, as documented on MSDN, makes the test run again correctly. I've attached a possible patch with this approach (SUREFIRE-1376-prefix.patch, that also handles UNC pathnames), but perhaps there is a better way to tackle this problem.

      In order to reproduce this, it is possible to create a project under lots of different subdirectories, something like:

      └───surefire-longpath-test-with-windows
          └───surefire-longpath-test-with-windows
              └───surefire-longpath-test-with-windows
                  └───surefire-longpath-test-with-windows
                      └───surefire-longpath-test-with-windows
                          │   pom.xml
                          │
                          └───src
                              └───test
                                  └───java
                                      └───Test.java
      

      As a side-note, this issue is behind the current Jenkins failures on maven-plugins-ITs-m3.1.x-with-maven-plugin-jdk-1.8_windows when running the ITs on the Assembly Plugin.

      Attachments

        1. SUREFIRE-1376-prefix.patch
          3 kB
          Guillaume Boué

        Activity

          People

            tibordigana Tibor Digana
            gboue Guillaume Boué
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: