On Tue, 21 Mar 2023 22:38:18 GMT, Chris Plummer <cjplum...@openjdk.org> wrote:

>> There are two GC related issues with this test that are being addressed. The 
>> test was limiting the heap size to 6m so if there is still a leak, it will 
>> be detected quickly. This proved to be too small of a size when using ZGC. 
>> For the most part changing the size to 7m fixed this issue. However, I was 
>> still seeing frequent issues with ZGC on macOS. This is explained by 
>> [JDK-8304449](https://bugs.openjdk.org/browse/JDK-8304449), which noticed 
>> (rarely) OOME on macos even when not using ZGC. From JDK-8304449:
>> 
>> "macOS has a thread behavior that is not seen on linux and windows that is 
>> causing more memory usage, which sometimes leads to this unexpected OOME. 
>> The debuggee side of the test constantly creates threads that do little more 
>> than a short sleep. It has a counter of "live" threads, and won't let that 
>> go over 500. On the debugger side it is just tracking ThreadStartEvents and 
>> ThreadDeathEvents. It keep tracks of threads (ThreadReferences) for which a 
>> ThreadStartEvent had been received but a ThreadDeathEvent has not. On linux 
>> and windows the count of outstanding threads is generally in the 200-400 
>> range, sometimes briefly going over 500. However, on macOS it is closer to 
>> 2400. This means a lot more ThreadReferences being tracked, which means more 
>> memory usage, so sometimes you see an OOME on macOS as a result. "
>> 
>> The `threads` collection mainly existed just so its size could be used to 
>> log the number of outstanding ThreadDeathEvents. I got rid of the `threads` 
>> collection and instead am just tracking the number of ThreadStartEvents and 
>> ThreadDeathEvents, and computing the difference to get the number of 
>> outstanding ThreadDeathEvents.
>
> Chris Plummer has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   get rid of some locals that are not needed

Thumbs up. Thanks for the explanations in the PR and in the
bug reports.

What kind of testing has been done on this fix?

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

Marked as reviewed by dcubed (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/13130#pullrequestreview-1363828549

Reply via email to