Maven surefire插件使Java 11上的jvm崩溃(通过直接写入派生的JVM 1中的本机流而损坏了STDOUT) [英] Maven surefire plugin crashing jvm on java 11 (Corrupted STDOUT by directly writing to native stream in forked JVM 1)

查看:304
本文介绍了Maven surefire插件使Java 11上的jvm崩溃(通过直接写入派生的JVM 1中的本机流而损坏了STDOUT)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Java 11运行Maven构建,该构建在运行测试时会发出以下警告:

Running a maven build using java 11, the build issues the following warning while running tests:

[WARNING] Corrupted STDOUT by directly writing to native stream in forked JVM 1. See FAQ web page and the dump file /home/thomas/code/irdeto-control/fps-license-service/fps/target/surefire-reports/2019-04-11T14-05-32_318-jvmRun1.dumpstream

...构建失败后,接着是以下stderr输出:

...followed by the following stderr output after the build fails:

$ cat error.message 
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.1:test (default-test) on project fps: There are test failures.
[ERROR] 
[ERROR] Please refer to /home/user/code/employer-control/fps-license-service/fps/target/surefire-reports for the individual test results.
[ERROR] Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
[ERROR] The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
[ERROR] Command was /bin/sh -c cd /home/user/code/employer-control/fps-license-service/fps && /usr/lib/jvm/jdk-11.0.2/bin/java '-javaagent:/home/user/.m2/repository/org/jacoco/org.jacoco.agent/0.8.0/org.jacoco.agent-0.8.0-runtime.jar=destfile=/home/user/code/employer-control/fps-license-service/fps/target/jacoco.exec,excludes=com.employer.rights.fairplay.*' -jar /home/user/code/employer-control/fps-license-service/fps/target/surefire/surefirebooter7853689441541829546.jar /home/user/code/employer-control/fps-license-service/fps/target/surefire 2019-04-11T14-05-32_318-jvmRun1 surefire11275213325677189658tmp surefire_01035200394006888746tmp
[ERROR] Error occurred in starting fork, check output in log
[ERROR] Process Exit Code: 134
[ERROR] org.apache.maven.surefire.booter.SurefireBooterForkException: The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
[ERROR] Command was /bin/sh -c cd /home/user/code/employer-control/fps-license-service/fps && /usr/lib/jvm/jdk-11.0.2/bin/java '-javaagent:/home/user/.m2/repository/org/jacoco/org.jacoco.agent/0.8.0/org.jacoco.agent-0.8.0-runtime.jar=destfile=/home/user/code/employer-control/fps-license-service/fps/target/jacoco.exec,excludes=com.employer.rights.fairplay.*' -jar /home/user/code/employer-control/fps-license-service/fps/target/surefire/surefirebooter7853689441541829546.jar /home/user/code/employer-control/fps-license-service/fps/target/surefire 2019-04-11T14-05-32_318-jvmRun1 surefire11275213325677189658tmp surefire_01035200394006888746tmp
[ERROR] Error occurred in starting fork, check output in log
[ERROR] Process Exit Code: 134
[ERROR]     at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:669)
[ERROR]     at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:282)
[ERROR]     at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:245)
[ERROR]     at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:1183)
[ERROR]     at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:1011)
[ERROR]     at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:857)
[ERROR]     at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
[ERROR]     at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)

//省略了堆叠框架

以下是转储流中的摘录,涉及上面的错误:

Here is an extract from the dump stream referring to the error above:

# Created at 2019-04-11T14:05:32.824
Corrupted STDOUT by directly writing to native stream in forked JVM 1. Stream 'FATAL ERROR in native method: processing of -javaagent failed'.
java.lang.IllegalArgumentException: Stream stdin corrupted. Expected comma after third character in command 'FATAL ERROR in native method: processing of -javaagent failed'.
        at org.apache.maven.plugin.surefire.booterclient.output.ForkClient$OperationalData.<init>(ForkClient.java:507)
        at org.apache.maven.plugin.surefire.booterclient.output.ForkClient.processLine(ForkClient.java:210)
        at org.apache.maven.plugin.surefire.booterclient.output.ForkClient.consumeLine(ForkClient.java:177)
        at org.apache.maven.plugin.surefire.booterclient.output.ThreadedStreamConsumer$Pumper.run(ThreadedStreamConsumer.java:88)
        at java.base/java.lang.Thread.run(Thread.java:834)

将surefire版本降为2.18可以防止jvm崩溃,但不执行测试.高于2.18的任何版本的surefire(包括最新版本)都会使构建崩溃,并出现上述错误.

Dropping the surefire version to 2.18 stops the jvm from crashing but does not execute the tests. Any version of surefire above 2.18 including the latest crashes the build with the errors above.

显然,我不是唯一一个遇到此问题的人,

I am clearly not the only one experiencing the issue as it is also shown here

此外,surefire开发社区也对此问题进行了讨论,对此问题进行了此处

Furthermore the issue is also known by the surefire development community as it is discussed here

也就是说,与大多数问题都无法在更新版本的插件中解决的问题不同,此问题似乎随着更新版本的surefire和jvm再次抬起头来.

That said, unlike most issues that tend to be resolved in more recent version of plugins, this issue appears to raise its ugly head again with the more recent versions of surefire and the jvm.

欢迎使用任何解决方案或解决方法.我正在使用以下版本:

Any solutions OR work-arounds are welcome. I am using the following versions:

Apache Maven 3.5.3 (3383c37e1f9e9b3bc3df5050c29c8aff9f295297; 2018-02-24T20:49:05 + 01:00)

Apache Maven 3.5.3 (3383c37e1f9e9b3bc3df5050c29c8aff9f295297; 2018-02-24T20:49:05+01:00)

Java版本:11.0.2 ,供应商:Oracle Corporation

Java version: 11.0.2, vendor: Oracle Corporation

OS名称:"linux",版本:"4.15.0-47-generic",拱门:"amd64",家族:"unix"

OS name: "linux", version: "4.15.0-47-generic", arch: "amd64", family: "unix"

maven.compiler.source:1.8

maven.compiler.target:1.8

maven-surefire-plugin.version:2.18< VERSION_USED< = 3.0.0-M3

推荐答案

不是解决方案,而是一种解决方法,请勿同时异步运行测试:

Not a fix, but a workaround, do not run tests concurrently, asynchronously:

    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-surefire-plugin</artifactId>
      <version>${maven-surefire-plugin.version}</version>
      <configuration>
        <forkCount>0</forkCount>
      </configuration>
    </plugin>

这篇关于Maven surefire插件使Java 11上的jvm崩溃(通过直接写入派生的JVM 1中的本机流而损坏了STDOUT)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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