On Wed, 18 Mar 2026 15:27:08 GMT, Zhengyu Gu <[email protected]> wrote:
>> And surely this whole loop can simplify to:
>>
>> while (true) {
>> if (count < 10) {
>> replaceThreads(ids, infos);
>> }
>> goSleep(1);
>> }
>
> I removed unused return value `replaced`.
>
> The simplified version is not equivalent - e.g. when `10 <= count <= 20`, the
> behavior depends on early `replacing` value.
I tested this version and it still causes the crash, so we can make the change
if you like.
As long as replaceThreads() gets called we cause trouble.
Actually this loop can be simpler:
139 while (true) {
140 replaceThreads(ids, infos);
141 goSleep(1);
142 }
My earlier experiment used hundreds of threads, finishing at different times,
and would stop replacing threads if there were many alive. But we only need a
few threads active to cause the problem quite reliably. So it can just
continually keep trying to replace threads, and it is enough to cause the crash.
The sleep was to yield and make sure other threads got a chance to crash us.
It it still required.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/30105#discussion_r2954414802