You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2016/10/26 22:20:58 UTC
[jira] [Commented] (SUREFIRE-1295) JVM crashes in forks do not log
the name of the failing test
[ https://issues.apache.org/jira/browse/SUREFIRE-1295?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15609865#comment-15609865 ]
ASF GitHub Bot commented on SUREFIRE-1295:
------------------------------------------
GitHub user michaeltandy opened a pull request:
https://github.com/apache/maven-surefire/pull/130
[SUREFIRE-1295] Attribute JVM crashes to tests
As explained in [SUREFIRE-1295](https://issues.apache.org/jira/browse/SUREFIRE-1295) it's a source of some inconvenience to me that, if a test crashes the forked JVM, there isn't clear logging of which test, if any, was running at the time of the crash.
This change makes JVM crash handling more like the handling of other errors, adding the JVM-crashing test to the count of Errors and the list of Tests in error.
Here's the log output before the patch, from version 2.19.1
```
[INFO] --- maven-surefire-plugin:2.19.1:test (default-test) @ crash-during-test ---
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running junit44.environment.BasicTest
Running junit44.environment.SomeOtherTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.027 sec - in junit44.environment.SomeOtherTest
Results :
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.149 s
[INFO] Finished at: 2016-10-26T23:12:07+01:00
[INFO] Final Memory: 19M/454M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test (default-test) on project crash-during-test: ExecutionException The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
[ERROR] Command was /bin/sh -c cd /home/mtandy/Documents/surefire-vmcrash/maven-surefire/surefire-integration-tests/src/test/resources/crash-during-test && /usr/lib/jvm/java-8-oracle/jre/bin/java -jar /home/mtandy/Documents/surefire-vmcrash/maven-surefire/surefire-integration-tests/src/test/resources/crash-during-test/target/surefire/surefirebooter1367113935938691280.jar /home/mtandy/Documents/surefire-vmcrash/maven-surefire/surefire-integration-tests/src/test/resources/crash-during-test/target/surefire/surefire6487093419506274719tmp /home/mtandy/Documents/surefire-vmcrash/maven-surefire/surefire-integration-tests/src/test/resources/crash-during-test/target/surefire/surefire_04459111308039624275tmp
[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
```
Here is the log output for the same tests, after applying this patch:
```
[INFO] --- maven-surefire-plugin:2.19.2-SNAPSHOT:test (default-test) @ crash-during-test ---
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running junit44.environment.BasicTest
[WARNING] Missing goodbye handling engaged.
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.035 s <<< FAILURE! - in testCrashJvm(junit44.environment.BasicTest)
[ERROR] testCrashJvm(junit44.environment.BasicTest) Time elapsed: 0.018 s <<< ERROR!
null
[ERROR] The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
Command was /bin/sh -c cd /home/mtandy/Documents/surefire-vmcrash/maven-surefire/surefire-integration-tests/src/test/resources/crash-during-test && /usr/lib/jvm/java-8-oracle/jre/bin/java -jar /home/mtandy/Documents/surefire-vmcrash/maven-surefire/surefire-integration-tests/src/test/resources/crash-during-test/target/surefire/surefirebooter4848491891931563261.jar /home/mtandy/Documents/surefire-vmcrash/maven-surefire/surefire-integration-tests/src/test/resources/crash-during-test/target/surefire/surefire1002822166442627824tmp /home/mtandy/Documents/surefire-vmcrash/maven-surefire/surefire-integration-tests/src/test/resources/crash-during-test/target/surefire/surefire_07708768178699511150tmp
Exit code was 66
Tests were running at the time.
[INFO] Running junit44.environment.SomeOtherTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.023 s - in junit44.environment.SomeOtherTest
[INFO]
[INFO] Results:
[INFO]
[ERROR] Tests in error:
[ERROR] junit44.environment.BasicTest.testCrashJvm(junit44.environment.BasicTest)
[INFO]
[ERROR] Tests run: 2, Failures: 0, Errors: 1, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.699 s
[INFO] Finished at: 2016-10-26T23:15:11+01:00
[INFO] Final Memory: 19M/446M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.19.2-SNAPSHOT:test (default-test) on project crash-during-test: There are test failures.
[ERROR]
[ERROR] Please refer to /home/mtandy/Documents/surefire-vmcrash/maven-surefire/surefire-integration-tests/src/test/resources/crash-during-test/target/surefire-reports for the individual test results.
[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
```
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/michaeltandy/maven-surefire attribute-jvm-crashes-to-tests
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/maven-surefire/pull/130.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #130
----
commit bdfecaf38892b4b37b309f158e69e24a5e16d1cc
Author: mtandy <mt...@mtandy-desktop>
Date: 2016-10-26T19:31:59Z
If the JVM crashes during a test, report which test was running at the time of the failure.
commit af2504ff328b463ea2954bacbd0eeaa7a89c4a1b
Author: mtandy <mt...@mtandy-desktop>
Date: 2016-10-26T20:48:40Z
Integration test for JVM crash attribution
commit 98493ae91beee948d8f5cb0326e6c3e22c3c5471
Author: mtandy <mt...@mtandy-desktop>
Date: 2016-10-26T21:12:37Z
Remove commented out code, re-enable style checkers
commit 10ce092e1015486f7c838b2b320aaf3e5bde1edc
Author: mtandy <mt...@mtandy-desktop>
Date: 2016-10-26T22:06:09Z
When forks aren't being reused, check other tests still run.
commit 93d96f769dca5e12c15bb9b75e7452372e38811e
Author: mtandy <mt...@mtandy-desktop>
Date: 2016-10-26T22:08:00Z
Merge remote-tracking branch 'origin/master' into attribute-jvm-crashes-to-tests
----
> JVM crashes in forks do not log the name of the failing test
> ------------------------------------------------------------
>
> Key: SUREFIRE-1295
> URL: https://issues.apache.org/jira/browse/SUREFIRE-1295
> Project: Maven Surefire
> Issue Type: Bug
> Components: Maven Surefire Plugin
> Affects Versions: 2.19.1
> Reporter: Michael Tandy
>
> I am using Surefire to test code accessed through JNI. Sometimes this code will fail, crashing the JVM.
> We run these tests in parallel ( forkCount=1C and reuseForks=false ) and it's not always obvious from the logs, which test caused a JVM crash - and although a command line is printed out, the booter temp files are removed automatically.
> For example:
> {code}
> [INFO] --- maven-surefire-plugin:2.19.1:test (default-test) @ crash-during-test ---
> -------------------------------------------------------
> T E S T S
> -------------------------------------------------------
> Running junit44.environment.BasicTest
> Results :
> Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
> [INFO] ------------------------------------------------------------------------
> [INFO] BUILD FAILURE
> [INFO] ------------------------------------------------------------------------
> [INFO] Total time: 1.337 s
> [INFO] Finished at: 2016-10-26T21:56:45+01:00
> [INFO] Final Memory: 19M/451M
> [INFO] ------------------------------------------------------------------------
> [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test (default-test) on project crash-during-test: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test failed: The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
> [ERROR] Command was /bin/sh -c cd /home/mtandy/Documents/surefire-vmcrash/maven-surefire/surefire-integration-tests/src/test/resources/crash-during-test && /usr/lib/jvm/java-8-oracle/jre/bin/java -jar /home/mtandy/Documents/surefire-vmcrash/maven-surefire/surefire-integration-tests/src/test/resources/crash-during-test/target/surefire/surefirebooter5241184363018251498.jar /home/mtandy/Documents/surefire-vmcrash/maven-surefire/surefire-integration-tests/src/test/resources/crash-during-test/target/surefire/surefire8973747106178765373tmp /home/mtandy/Documents/surefire-vmcrash/maven-surefire/surefire-integration-tests/src/test/resources/crash-during-test/target/surefire/surefire_01102526888161398167tmp
> [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/PluginExecutionException
> {code}
> The situation could be improved if such crashes more closely resembled other test errors - such as by logging the test that was in progress when the crash happened.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)