On Fri, 11 Dec 2020 21:47:33 GMT, Patricio Chilano Mateo 
<pchilanom...@openjdk.org> wrote:

>>> Pumpers created by ProcessTools.startProcess() log the process 
>>> stdout/stderr.
>>> It's quite useful for failure analysis.
>> 
>> This was the type of thing I was hinting at when I asked if there were any 
>> possible negative side affects to the change. Sorry I didn't see your post 
>> before asking my question.
>
> Hi Alex,
> 
>> Pumpers created by ProcessTools.startProcess() log the process stdout/stderr.
>> It's quite useful for failure analysis.
> But we are still printing the stdout and stderr of the jcmd with the log 
> statement in runJCmd().

Hi Chris,

> From what I can tell (after a bit of possibly inaccurate grepping) this is 
> the only test that uses `PrcoessTools.startProcess()` in combination with 
> `out.stderrShouldBeEmtpyIgnoreWarnings()`, so I assume this issue of split 
> stderr output is unique to this test. However, it seems like that could 
> easily be stumbled into again, and I pity anyone who has to debug this again 
> (and commend you and getting to the root of the issue).
> 
I also did a search and the other serviceability tests I found using 
stderrShouldBeEmtpyIgnoreWarnings() execute the process with 
ProcessBuilder::start().

> I have to admit I don't understanding all the ramifications of moving from 
> `ProcessTools.startProcess()` to just calling `pb.Start()`. Clearly 
> `startProcess()` has some value add. Does not using it affect the test in any 
> negative way?
> 
Looking at ProcessTools.startProcess(), it just calls ProcessBuilder::start() 
and then executes all the other StreamPumper logic.

> It's also not clear to me what the guidelines are for avoiding this issue in 
> the future. Is it that `startProcess()` + `OutputAnalyzer` on the same 
> process is forbidden, or at least forbidden if the `OutputAnalyzer` is used 
> for anything more than checking the exit value?
> 
Right. Otherwise we have a race and the output of the launched process will be 
split between the two StreamPumpers in an unpredictable way.

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

PR: https://git.openjdk.java.net/jdk/pull/1749

Reply via email to