Skip to content

[Java][Windows] Intermittent failure to run unit test (failed: Error occurred in starting fork) #238

Description

@asfimport

There are some cases when Java modules are running unit test on Windows server and finished with errors (i.e https://github.com/apache/arrow/actions/runs/3191692688/jobs/5208306317).

 

[INFO] Arrow Memory - Netty ............................... FAILURE [  9.975 s]
820

[INFO] ------------------------------------------------------------------------
835[INFO] BUILD FAILURE
836[INFO] ------------------------------------------------------------------------
837[INFO] Total time:  45.950 s (Wall Clock)
838[INFO] Finished at: 2022-10-05T18:25:21Z
839[INFO] ------------------------------------------------------------------------
840Error:  Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M7:test (default-test) on project arrow-memory-netty: 
841Error:  
842Error:  Please refer to D:\a\arrow\arrow\java\memory\memory-netty\target\surefire-reports for the individual test results.
843Error:  Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
844Error:  ExecutionException The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
845Error:  Command was cmd.exe /X /C "C:\hostedtoolcache\windows\Java_Temurin-Hotspot_jdk\11.0.16-101\x64\bin\java --add-opens=java.base/java.nio=ALL-UNNAMED -jar C:\Users\runneradmin\AppData\Local\Temp\surefire10687308957494794092\surefirebooter-20221005182515867_28.jar C:\Users\runneradmin\AppData\Local\Temp\surefire10687308957494794092 2022-10-05T18-25-03_889-jvmRun2 surefire-20221005182515867_26tmp surefire_2-20221005182515867_27tmp"
846Error:  Error occurred in starting fork, check output in log
847Error:  Process Exit Code: -1073740940
848Error:  org.apache.maven.surefire.booter.SurefireBooterForkException: ExecutionException The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
849Error:  Command was cmd.exe /X /C "C:\hostedtoolcache\windows\Java_Temurin-Hotspot_jdk\11.0.16-101\x64\bin\java --add-opens=java.base/java.nio=ALL-UNNAMED -jar C:\Users\runneradmin\AppData\Local\Temp\surefire10687308957494794092\surefirebooter-20221005182515867_28.jar C:\Users\runneradmin\AppData\Local\Temp\surefire10687308957494794092 2022-10-05T18-25-03_889-jvmRun2 surefire-20221005182515867_26tmp surefire_2-20221005182515867_27tmp"
850Error:  Error occurred in starting fork, check output in log
851Error:  Process Exit Code: -1073740940
852Error:  	at org.apache.maven.plugin.surefire.booterclient.ForkStarter.awaitResultsDone(ForkStarter.java:513)
853Error:  	at org.apache.maven.plugin.surefire.booterclient.ForkStarter.runSuitesForkOnceMultiple(ForkStarter.java:397)
854Error:  	at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:326)
855Error:  	at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:269)
856Error:  	at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:1334)
857Error:  	at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:1167)
858Error:  	at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:931)
859Error:  	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
860Error:  	at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2(MojoExecutor.java:370)
861Error:  	at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute(MojoExecutor.java:351)
862Error:  	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:215)
863Error:  	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:171)
864Error:  	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:163)
865Error:  	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
866Error:  	at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call(MultiThreadedBuilder.java:210)
867Error:  	at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call(MultiThreadedBuilder.java:195)
868Error:  	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
869Error:  	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
870Error:  	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
871Error:  	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
872Error:  	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
873Error:  	at java.base/java.lang.Thread.run(Thread.java:829)
874Error:  Caused by: org.apache.maven.surefire.booter.SurefireBooterForkException: The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
875Error:  Command was cmd.exe /X /C "C:\hostedtoolcache\windows\Java_Temurin-Hotspot_jdk\11.0.16-101\x64\bin\java --add-opens=java.base/java.nio=ALL-UNNAMED -jar C:\Users\runneradmin\AppData\Local\Temp\surefire10687308957494794092\surefirebooter-20221005182515867_28.jar C:\Users\runneradmin\AppData\Local\Temp\surefire10687308957494794092 2022-10-05T18-25-03_889-jvmRun2 surefire-20221005182515867_26tmp surefire_2-20221005182515867_27tmp"
876Error:  Error occurred in starting fork, check output in log
877Error:  Process Exit Code: -1073740940
878Error:  	at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:714)
879Error:  	at org.apache.maven.plugin.surefire.booterclient.ForkStarter.lambda$runSuitesForkOnceMultiple$3(ForkStarter.java:388)
880Error:  	... 4 more
881Error:  -> [Help 1]
882Error:  
883Error:  To see the full stack trace of the errors, re-run Maven with the -e switch.
884Error:  Re-run Maven using the -X switch to enable full debug logging.
885Error:  
886Error:  For more information about the errors and possible solutions, please read the following articles:
887Error:  [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
888Error:  
889Error:  After correcting the problems, you can resume the build with the command
890Error:    mvn <args> -rf :arrow-memory-netty
891Error: Process completed with exit code 1. 

Reporter: David Dali Susanibar Arce / @davisusanibar

Note: This issue was originally created as ARROW-17947. Please see the migration documentation for further details.

Activity

  1. transferred this issue fromapache/arrowon Nov 26, 2024
  2. andygrove commented on Oct 31, 2026

    @andygrove
    Member

    This still happens in the current Windows CI job, and I think the cause is TestEmptyArrowBuf.testEmptyArrowBuf, which writes past the end of a native allocation.

    From 2026-08-25 to 2026-10-31 it caused 21 of the 38 failures of "AMD64 Windows Server 2022 Java JDK 17" (about 7% of runs in October), on main, on Dependabot PRs and on unrelated PRs. All 20 tests in arrow-memory-netty pass, and then surefire reports:

    [INFO] Arrow Memory - Netty ............................... FAILURE
    [ERROR] ExecutionException Error occurred in starting fork, check output in log
    

    Example on main: https://github.com/apache/arrow-java/actions/runs/41178662172/job/124471369915

    The exit code in the original report, -1073740940, is 0xC0000374 (STATUS_HEAP_CORRUPTION), so Windows is killing the test JVM because its native heap is corrupt. On Windows, surefire now runs each test class in its own JVM (reuseForks=false). The crash therefore happens when that JVM exits, and this error path does not print the exit code. The JVM that dies is the one running TestEmptyArrowBuf. When the Develocity extension logs Connection reset, it does so right after that class finishes, after the other concurrent fork has already exited.

    testEmptyArrowBuf builds a 1024-byte ArrowBuf over new PooledByteBufAllocatorL().empty.memoryAddress() and writes 10 bytes through it. That address belongs to Netty's EmptyByteBuf, which is backed by ByteBuffer.allocateDirect(0). The JDK satisfies that with an 8-byte malloc, because Unsafe.allocateMemory rounds up to 8. So the test writes 2 bytes past the end of the allocation. On 64-bit Windows an 8-byte heap block has no slack, so those bytes land on the next block's header.

    The overrun reproduces on macOS if malloc is interposed so that 8-byte allocations end at a guard page. testEmptyArrowBuf then fails with java.lang.InternalError: a fault occurred in a recent unsafe memory access operation. Backing the buffer with real memory from the test's own allocator fixes it.

  3. added this to the 20.0.0 milestone on Oct 31, 2026
  4. added a commit that references this issue on Nov 1, 2026
  5. added a commit that references this issue on Nov 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions