RFR: 8219197: ThreadGroup.enumerate() may return wrong value

Pavel Rappo pavel.rappo at oracle.com
Wed Mar 13 14:02:38 UTC 2019

Hi Daniel,

First of all, the change looks good to me. The broken

  if (destroyed) {
      return n;

part looks like a "copy and paste" from some other method in the ThreadGroup
class. They use recursion a lot.

Might it be the case that not only the returned value is wrong, but also the
populated list is corrupted? After all the returned value is used as an index
for the next insertion.


> On 12 Mar 2019, at 15:59, Daniel Fuchs <daniel.fuchs at oracle.com> wrote:
> Hi,
> Please find below a simple fix for
> 8219197: ThreadGroup.enumerate() may return wrong value
> http://cr.openjdk.java.net/~dfuchs/webrev_8219197/webrev.00/
> This is a bug in the implementation of the recursion,
> as enumerate(list, n, recurse) should never have returned
> a value < n.
> The test passes with the fix and fails 'often enough' without
> it (~ 1 times out of 2 or 3).
> best regards,
> -- daniel

More information about the core-libs-dev mailing list