apache / apache/maven-surefire

[SUREFIRE-1629] Plugin crashes if tests are forked and JPMS error occurs

Open
#2,159 2 comments 0 reactions 0 assignees View on GitHub
enhancement priority:major
Dominant language
Java
Stars
461
Forks
588
Avg merge
1d 8h
Merged PRs (30d)
19

Description

**[Gili](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=cowwoc)** opened **[SUREFIRE-1629](https://issues.apache.org/jira/browse/SUREFIRE-1629?redirect=false)** and commented

I tried running a test against an application with split packages and ended up with the following message in the `dumpstream file`:

```java
1. Created at 2019-01-25T16:20:23.856
Corrupted STDOUT by directly writing to native stream in forked JVM 1. Stream 'Error occurred during initialization of boot layer'.
java.lang.IllegalArgumentException: Stream stdin corrupted. Expected comma after third character in command 'Error occurred during initialization of boot layer'.
at org.apache.maven.plugin.surefire.booterclient.output.ForkClient$OperationalData.(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)

1. Created at 2019-01-25T16:20:23.857
Corrupted STDOUT by directly writing to native stream in forked JVM 1. Stream 'java.lang.LayerInstantiationException: Package com.foobar.internal.scope in both module com.foobar.database and module com.foobar.backend'.
java.lang.IllegalArgumentException: Stream stdin corrupted. Expected comma after third character in command 'java.lang.LayerInstantiationException: Package com.foobar.internal.scope in both module com.foobar.database and module com.foobar.backend'.
at org.apache.maven.plugin.surefire.booterclient.output.ForkClient$OperationalData.(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)
```

 
Expected behavior: the Surefire plugin should surface this error message to stdout/stderr instead making developers dig into the dumpstream file.

---

**Affects:** 2.22.1

**Attachments:**
- [testcase.zip](https://issues.apache.org/jira/secure/attachment/12956452/testcase.zip) (_6.78 kB_)

**Remote Links:**
- [GitHub Pull Request #299
](https://github.com/apache/maven-surefire/pull/299)

Contributor guide

Open the contributing guide

Research direction

Read the ForkClient.java stack frames and inspect testcase.zip; compare the behavior represented by GitHub PR #299. Verify that the JPMS initialization and split-package messages are surfaced on stdout/stderr rather than only in the dumpstream file.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system, testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.