RFR: 8338708: Don't create/destroy debug agent cmdQueueLock for each connection.

Leonid Mesnik lmesnik at openjdk.org
Fri Aug 30 21:13:18 UTC 2024


On Fri, 30 Aug 2024 20:18:15 GMT, Chris Plummer <cjplummer at openjdk.org> wrote:

>> test/jdk/com/sun/jdi/ReattachStressTest.java line 76:
>> 
>>> 74:             // Read the first character of output to make sure we've waited until the
>>> 75:             // debuggee is ready. This will be the debug agent's "Listening..." message.
>>> 76:             InputStream is = p.getInputStream();
>> 
>> The stream is not closed. Not sure it can cause problems but probably could once we reuse agent for tests.
>
> The `InputStream` is already created when the `Process` is spawned. This API is simply returning it. It doesn't seem appropriate to close it in this case. It should be closed automatically when the Process is destroyed. I also see a lot of other uses of `p.getInputStream()` that don't explicitly close, including some which are obviously not closed:
> 
> `        p.getInputStream().read();`

Thanks for explanation, sorry for noise.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20755#discussion_r1739415245


More information about the serviceability-dev mailing list