RFR: 8291986: ProcessBuilder.redirectErrorStream(true) leaves error stream available [v2]
Jaikiran Pai
jpai at openjdk.org
Tue Jan 13 17:10:01 UTC 2026
On Mon, 12 Jan 2026 20:51:51 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 one additional commit since the last revision:
>
> Refactored invocation of `lsof` to not use pipes for I/O, using files instead.
> It removes the possibility of side effects that might affect the checking of pipe usage.
Hello Roger, given what's explained in the JBS issue, this change looks reasonable to me. I just have one test related comment which I've added inline.
test/jdk/java/lang/ProcessBuilder/PipelineLeaksFD.java line 54:
> 52: * @requires os.family == "mac" | (os.family == "linux" & !vm.musl)
> 53: * @summary File descriptor leak detection with ProcessBuilder.startPipeline
> 54: * @run junit/othervm -Xint PipelineLeaksFD
Is there something in this test (or even `java.lang.Process`) that makes running this test in interpreted mode a necessity?
-------------
Marked as reviewed by jpai (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/29143#pullrequestreview-3656896789
PR Review Comment: https://git.openjdk.org/jdk/pull/29143#discussion_r2687310909
More information about the core-libs-dev
mailing list