I'm quite surprised, that nobody noticed that "Threads" tab in Configuration Status generates invalid result.
There are two problems:
1. The number of reported threads in the status is incorrect.
The reason is that we are enumerating all threads in all thread groups. However in some JVMs enumerating the root thread group will return all threads. So we count the threads at least twice - once being enumerated from the root group, and once - from their own thread group.
2. Some threads are not printed at all.
Our comparators doesn't guarantee that the null elements in the array will always get at the end of the array. So occasionally we can get a sorted array with nulls in front. Then, if we print one the first N (the actual thread count) from the array. Nulls are skipped, but the counter is increased, so finally some threads remain unprinted.