RFR: 8340334: Update jcmd VM.events max parameter to be INT [v2]

David Holmes dholmes at openjdk.org
Fri Nov 22 06:41:20 UTC 2024


On Thu, 21 Nov 2024 06:33:30 GMT, Leonid Mesnik <lmesnik at openjdk.org> wrote:

>> Okay but just to be clear, this change means that the maximum value of this parameter is no longer limited to a 32-bit integer maximum, but is now a 64-bit maximum - the old `parse_integer` function was passed `int` not `jlong`.
>
> As I understand, the "INT" as parsed as jlong in jcmd. It is not limited by 32-bit. So that's ok. I thought to change max from int to size_t as it done in many cases or check if it too big for jint.
> However, I doubt that anyone is going to use so huge numbers there. 
> The VM.events prints several latest event, remembered by Hotspot. The max number is set by LogEventsBufferEntries and is 20 by default and 250 for ZGC. The hard-limit is 1*M.
> So any value more then LogEventsBufferEntries doesn't limit anything. 
> Might be makes sense to treat all values > MAX_INT just as unlimited just in case someone made mistake?

const char* max_value = _max.value();
  int max = -1;
  if (max_value != nullptr) {
    char* endptr = nullptr;
    if (!parse_integer(max_value, &max)) {

`parse_integer` is a template function and it was passed an `int` so it limits to int values.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/22224#discussion_r1853356424


More information about the serviceability-dev mailing list