jmx-dev RFR: 8299560: Assertion failed: currentQueryIndex >= 0 && currentQueryIndex < numberOfJavaProcessesAtInitialization

Leonid Mesnik lmesnik at openjdk.org
Tue Sep 26 16:53:15 UTC 2023


On Tue, 26 Sep 2023 08:59:21 GMT, Kevin Walls <kevinw at openjdk.org> wrote:

>> src/jdk.management/windows/native/libmanagement_ext/OperatingSystemImpl.c line 780:
>> 
>>> 778:     int currentQueryIndex = currentQueryIndexForProcess();
>>> 779: 
>>> 780:     assert(currentQueryIndex < numberOfJavaProcessesAtInitialization);
>> 
>> doesn't it make sense to change assert to currentQueryIndex >= -1, so any other negative numbers are still hit assertion?
>
> Thanks Leonid, I didn't see much value in that - we can see in the same file the return value of currentQueryIndexForProcess() is going to be -1 or an index from the for loop iteration from 0 to INT_MAX.
> We can do that if you really feel it has a benefit?

Fine then. Thank you for the explanation.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/15750#discussion_r1337521726


More information about the jmx-dev mailing list