由于Maven-surefire-plugin出现VM崩溃,GitLab CI失败 [英] GitLab CI is failing due to maven-surefire-plugin with VM crash

查看:182
本文介绍了由于Maven-surefire-plugin出现VM崩溃,GitLab CI失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们大约有10个不同的应用程序,它们是Groovy的Spring Boot项目.

We have around of 10 different applications that are Spring Boot projects with Groovy.

我们所有的项目都可以在所有开发人员工作站中正确构建,并且可以正常运行直到昨天,但是突然之间,今天所有的项目仅在我们的GitLab CI管道中停止了工作,出现以下错误:

All of our projects build correctly in all developer work stations and they were running correctly until yesterday, however suddenly all of them stopped working today only in our GitLab CI pipelines with below error:

[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:37 min
[INFO] Finished at: 2018-10-31T17:49:11Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.21.0:test (default-test) on project ctg-oms-component: There are test failures.
[ERROR] 
[ERROR] Please refer to /builds/ctg-integrations/ctg-oms-component/target/surefire-reports for the individual test results.
[ERROR] Please refer to dump files (if any exist) [date]-jvmRun[N].dump, [date].dumpstream and [date]-jvmRun[N].dumpstream.
[ERROR] ExecutionException The forked VM terminated without properly saying goodbye. VM crash or System.exit called?

我已经提取了与使用我们的GitLab CI管道相同的docker映像,测试了构建项目,并且一切正常.但是,该错误仅在GitLab CI中发生.

I've pulled the same docker image that is using our GitLab CI pipeline, tested building the project and everything works correctly. However, the error occurs only in GitLab CI.

经过调查,似乎surefire正在创建一个使GitLab CI docker崩溃的fork.为了解决此问题,我在显式配置下面添加了避免分叉的VM的方法,这避免了上述错误.

After an investigation looks like surefire is creating a fork that makes GitLab CI docker crash. In order to fix this, I've added below explicit configuration to avoid forked VM and this got rid of above error.

<!-- Needed only for GitLab CI -->
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <configuration>
        <forkCount>0</forkCount>
    </configuration>
</plugin>

您知道为什么会这样吗?还有另一种修复GitLab CI的方法来避免此问题吗?我真的不喜欢这种解决方法,因为它只是避免GitLab CI爆炸的一种方式,但不知道在Gitlab中如何处理Docker.

Do you know why this is occurring? Is there another way to fix GitLab CI to avoid this issue? I don't really like this workaround, since it is just a way to avoid GitLab CI to explode but don't know how Docker is handled behind the scenes in Gitlab.

推荐答案

问题与最新的maven docker映像有关.

The issues are related to the latest maven docker images.

存在一个公开的github问题,人们报告了同样的问题: https://github.com/carlossg/docker-maven/issues/90

There is an open github issue where people reported the same problem: https://github.com/carlossg/docker-maven/issues/90

经过调查,我可以使用alpine版本来解决问题,省去了添加maven-surefire-plugin解决方法的麻烦.值得一提的是,使用surefire解决方法会带来另一个问题,例如像jacoco这样的插件由于需要VM分支而无法运行.

After an investigation I could sort out the problem using alpine version that saved me of adding the maven-surefire-plugin workaround. It's important to mention that using the surefire workaround brings another problem such as plugins like jacoco don't run since they need the VM fork.

因此,这些图像可以无缝运行(不需要surefire解决方法):

So, these images work seamlessly (no surefire workaround was needed):

  • maven:3.3.9-jdk-8
  • maven:3.5.3-jdk-8
  • maven:3.5.4-jdk-8-alpine
  • maven:3.6.0-jdk-8-alpine

但是,如果我们使用非高山版本,该问题仍然存在.

However if we use the non alpine version the issue persists.

这篇关于由于Maven-surefire-plugin出现VM崩溃,GitLab CI失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆