RFR: 8233725: ProcessTools.startProcess() has output issues when using an OutputAnalyzer at the same time [v2]
Leonid Mesnik
lmesnik at openjdk.org
Thu Apr 20 23:05:45 UTC 2023
On Thu, 20 Apr 2023 22:22:06 GMT, Chris Plummer <cjplummer at openjdk.org> wrote:
>> Leonid Mesnik has updated the pull request incrementally with one additional commit since the last revision:
>>
>> JStackStressTest.java updated.
>
> test/jdk/sun/tools/jhsdb/JStackStressTest.java line 86:
>
>> 84: } catch (InterruptedException e) {
>> 85: }
>> 86: OutputAnalyzer jshellOutput = new OutputAnalyzer(jShellProcess);
>
> It's not clear to me how moving this is fixing anything.
It is the main issues with current approach. The outputanalyzer tries to read from streams which are available only when process finishes. This test interact with process so it just hangs waiting of process completion.
> test/jdk/sun/tools/jstatd/JstatdTest.java line 357:
>
>> 355: assertEquals(stdout.size(), 1, "Output should contain one line");
>> 356: assertTrue(stdout.get(0).startsWith("jstatd started"), "List should start with 'jstatd started'");
>> 357: assertNotEquals(output.getExitValue(), 0,
>
> Before your fix, was the "jstatd started" line being missed because of this bug.
Yep. the output was "empty" before fix.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13560#discussion_r1173155279
PR Review Comment: https://git.openjdk.org/jdk/pull/13560#discussion_r1173155433
More information about the serviceability-dev
mailing list