apache / apache/maven-surefire
[SUREFIRE-2127] Resource temporarily unavailable when running tests that invoke Node using Surefire 3
- Dominant language
- Java
- Stars
- 461
- Forks
- 588
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 19
Description
**[Artur](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=JIRAUSER282083)** opened **[SUREFIRE-2127](https://issues.apache.org/jira/browse/SUREFIRE-2127?redirect=false)** and commented
When running the Vaadin Flow test set using surefire 3.0.0-M7 we always end up with
```java
[SUREFIRE] std/in stream corrupted
java.io.IOException: Resource temporarily unavailable
at java.base/java.io.FileInputStream.readBytes(Native Method)
at java.base/java.io.FileInputStream.read(FileInputStream.java:276)
at java.base/java.io.BufferedInputStream.read1(BufferedInputStream.java:282)
at java.base/java.io.BufferedInputStream.read(BufferedInputStream.java:343)
at java.base/java.io.BufferedInputStream.fill(BufferedInputStream.java:244)
at java.base/java.io.BufferedInputStream.read1(BufferedInputStream.java:284)
at java.base/java.io.BufferedInputStream.read(BufferedInputStream.java:343)
at org.apache.maven.surefire.api.util.internal.Channels$3.readImpl(Channels.java:217)
at org.apache.maven.surefire.api.util.internal.AbstractNoninterruptibleReadableChannel.read(AbstractNoninterruptibleReadableChannel.java:54)
at org.apache.maven.surefire.api.stream.AbstractStreamDecoder.read(AbstractStreamDecoder.java:484)
at org.apache.maven.surefire.api.stream.AbstractStreamDecoder.read(AbstractStreamDecoder.java:470)
at org.apache.maven.surefire.api.stream.AbstractStreamDecoder.readMessageType(AbstractStreamDecoder.java:118)
at org.apache.maven.surefire.booter.stream.CommandDecoder.decode(CommandDecoder.java:87)
at org.apache.maven.surefire.booter.spi.CommandChannelDecoder.decode(CommandChannelDecoder.java:67)
at org.apache.maven.surefire.booter.CommandReader$CommandRunnable.run(CommandReader.java:345)
at java.base/java.lang.Thread.run(Thread.java:833)
```
This problem is introduced in [SUREFIRE-1658](https://issues.apache.org/jira/projects/SUREFIRE/issues/SUREFIRE-1658), verified using git bisect
It seems to occur in tests that invoke `pnpm` through `node` so potentially this is related to https://github.com/nodejs/node/issues/42826 as the error message "Resource temporarily unavailable" seems to refer to EAGAIN https://stackoverflow.com/a/4058377/3336733 or in other words that the file descriptor is in non-blocking mode and there is no data available to read.
The Vaadin Flow PR where this has been tested is https://github.com/vaadin/flow/pull/15102
Can be reproduced by checking out that branch (`upgrade-test-runners`) and running `mvn test`. It will fail on the `flow-server` module from where all tests except one have been removed.
---
**Affects:** 3.0.0-M7
1 votes, 2 watchers
Contributor guide
Research direction
Reproduce the failure by checking out the `upgrade-test-runners` branch and running `mvn test`; the failure occurs in the `flow-server` module. Start with `Channels.java`, `AbstractNoninterruptibleReadableChannel.java`, and `AbstractStreamDecoder.java` from the stack trace, then compare behavior around tests invoking `pnpm` through Node. Done means the affected tests complete without the `Resource temporarily unavailable` or corrupted stream error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, nodejs
- Domain
- build-system, testing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100