RFR: 8291986: ProcessBuilder.redirectErrorStream(true) leaves error stream available [v3]

Jaikiran Pai jpai at openjdk.org
Wed Jan 14 07:33:02 UTC 2026


On Tue, 13 Jan 2026 21:47:40 GMT, Roger Riggs <rriggs at openjdk.org> wrote:

>> On Linux and Mac, when a process is started, pipes are created to communicate with the child.
>> In the case where the stderr is redirected to stdout using `ProcessBuilder.redirectErrorStream()`, the pipe is not needed and should not be created.
>> 
>> Added a test to check pipe creation when spawning with and without `redirectErrorStream(t/f)`. 
>> Rewrote the extraction of pipes to use `lsof` available on Mac and Linux. (previously used Linux /proc/pid/fd/...)
>> Converted PipelineLeaksFD test to JUnit.
>
> Roger Riggs has updated the pull request incrementally with two additional commits since the last revision:
> 
>  - Some test platforms do not have `lsof` installed, if not available,
>    the tests are skipped.
>  - Remove extra -Xint test run, its purpose is unknown.

The test updates look good to me.

I see that the test now uses `EnabledIf` from JUnit. Do you know if the test gets skipped then would it show up in the skipped count listed for the test:

> [ JUnit Tests: found 5, started 5, succeeded 5, failed 0, aborted 0, skipped 0]

Actually, the GitHub actions job test failure looks related to this change:


Extra pipes in pipesAfter: [0]
org.opentest4j.AssertionFailedError: More or fewer pipes than expected
    at org.junit.jupiter.api.AssertionUtils.fail(AssertionUtils.java:38)
    at org.junit.jupiter.api.Assertions.fail(Assertions.java:138)
    at PipelineLeaksFD.checkForLeaks(PipelineLeaksFD.java:133)

-------------

Marked as reviewed by jpai (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/29143#pullrequestreview-3659261972
PR Comment: https://git.openjdk.org/jdk/pull/29143#issuecomment-3748198076


More information about the core-libs-dev mailing list