2017-02-17 80 views
1

我有一千個測試Java項目,Maven構建運行測試時發生故障,由於JVM崩潰

當我進行的測試,它結束如下:

$ mvn surefire:test 
. . . 
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD FAILURE 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 01:49 h 
[INFO] Finished at: 2017-02-17T06:29:55-05:00 
[INFO] Final Memory: 13M/921M 
[INFO] ------------------------------------------------------------------------ 
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.16:test (default-cli) on project Mine: ExecutionException; nested exception is java.util.concurrent.ExecutionException: java.lang.RuntimeException: The forked VM terminated without saying properly goodbye. VM crash or System.exit called ? 
[ERROR] Command was/bin/sh -c cd /home/projects/mine && /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.131-2.6.9.0.el7_3.x86_64/jre/bin/java -jar /home/projects/mine/target/surefire/surefirebooter5661758071622971420.jar /home/projects/mine/target/surefire/surefire7221142682471689181tmp /home/projects/mine/target/surefire/surefire_96350455888867423114tmp 
[ERROR] -> [Help 1] 
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. 
[ERROR] Re-run Maven using the -X switch to enable full debug logging. 
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles: 
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException 

我Maven的配置如下:

$ mvn -version 
Apache Maven 3.3.1 (cab6659f9874fa96462afef40fcf6bc033d58c1c; 2015-03-13T16:10:27-04:00) 
Maven home: /opt/maven 
Java version: 1.7.0_131, vendor: Oracle Corporation 
Java home: /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.131-2.6.9.0.el7_3.x86_64/jre 
Default locale: en_US, platform encoding: UTF-8 
OS name: "linux", version: "3.10.0-514.6.1.el7.x86_64", arch: "amd64", family: "unix" 

我試着用-X選項更新行家或重新運行測試,但沒有發現什麼特別的東西。任何想法如何調試/處理這個問題?

更新 我發現問題與使用某些本機代碼的較新版本有關。我必須替換舊版本的lib版本文件.so來解決問題。

+0

同意@khmarbaise。嘗試更新插件版本,2.16是舊的(2013!),並且自那時以來已經做出了許多修復..可能完全解決了這個問題,或者至少爲您提供了有關問題真實性的更多線索。 – user944849

+0

這不是插件版本的問題,因爲我的同事在同一個項目上工作沒有這個問題。 – bachr

+0

好的,從具有該問題的計算機上的空本地回購開始。一個或多個工件可能會損壞,我以前見過這種情況。 – user944849

回答

0

用你的maven插件試試這個。也許你的測試用例需要大量的內存,以便修改此,如果仍然發生這種碰撞

<argLine>-Xmx1024m -XX:MaxPermSize=256m</argLine> 

而在最後看起來像這樣

<plugin> 
    <groupId>org.apache.maven.plugins</groupId> 
    <artifactId>maven-surefire-plugin</artifactId> 
    <version>2.x</version> 
    <configuration> 
     <forkMode>once</forkMode> 
    <argLine>-Xmx1024m -XX:MaxPermSize=256m</argLine> 
    </configuration> 
</plugin> 
+1

不要使用[maven-surefire-plugin]這樣的舊版本(https://maven.apache.org/surefire/maven-surefire-plugin/) – khmarbaise

+0

我不好意思添加了2.x以免讓人困惑 – Gatusko

+0

我已經嘗試使用maven選項來增加內存,但沒有幫助 – bachr

相關問題