LoginSignup
1
3

More than 1 year has passed since last update.

The forked VM terminated without saying properly goodbyeした時の対処方法

Last updated at Posted at 2021-10-14

事象

mvn testでJUnitテスト実行失敗。下記のエラーログがでた。

The forked VM terminated without saying properly goodbye. VM crash or System.exit called

"forked"とは?

「フォークする」= テストするためにJVM内にプロセスを生成すること

mavenでJUnitテスト実行するときには「maven-surefire-plugin」というプラグイン経由で実行する(のが普通だと思ってる)のだが、テスト用に生成するプロセス数は↓のようにforkCountで制御できる。

例) フォークする最大プロセス数を「3」に設定する
<project>
    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-surefire-plugin</artifactId>
                 <configuration>
                  <forkCount>3</forkCount>
                  <argLine>-Xmx1024m</argLine>
                 </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>
</project>

原因

1つのプロセスでさばくにはテスト負荷が高すぎて死んだ。

The default setting is forkCount=1/reuseForks=true, which means that maven-surefire-plugin creates one new JVM process to execute all tests in one Maven module.
https://maven.apache.org/surefire/maven-surefire-plugin/examples/fork-options-and-parallel-execution.html#


対処方法

forkCountのデフォルト値は「1」なので、これを「3」に変更して実行したらmvn testうまくいった(´_ゝ`)


参考

1
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
3