Field maxSize of event jdk.YoungGenerationConfiguration can be set to Long.MIN_VALUE

Erik Gahlin erik.gahlin at oracle.com
Wed Jun 14 07:44:50 UTC 2023


Hi Frederic,

I didn't see your post until now, I was on vacation last week..

Yes, Long.MIN_VALUE has special meaning, It means the value is missing or not applicable.

Erik
________________________________
From: hotspot-jfr-dev <hotspot-jfr-dev-retn at openjdk.org> on behalf of Frederic Thevenet <fthevene at redhat.com>
Sent: Tuesday, June 6, 2023 9:56 PM
To: hotspot-jfr-dev at openjdk.org <hotspot-jfr-dev at openjdk.org>
Subject: Field maxSize of event jdk.YoungGenerationConfiguration can be set to Long.MIN_VALUE

Hi,

I recently reported on an issue where invoking the command "jfr print"
on a recording that contain events where one of the field in is an
amount in bytes whose value is Long.MIN_VALUE (or invoking "toString()"
on such an event), you'd the following error:
jfr print: unexpected internal error, Index -1 out of bounds for length 6

Now, I believe the root cause and fix to the issue to be pretty trivial
and I submitted a PR for that, but I am trying to understand if the
event that revealed the bug is really supposed to report such a value,
or if there's another problem at play here.

The event type in question is "jdk.YoungGenerationConfiguration" whose
"maxSize" field is always equal to Long.MIN_VALUE when the GC in use is
ShenandoahGC or ZGC.
Now, I'm guessing that Shenandoah and ZGC not being generational, this
particular configuration item is probably mostly ignored/useless, in
which case, I feel it isn't fully unexpected that if present
nonetheless, such events would be populated with default values which,
from a cursory glance at gcConfiguration.hpp[2] looks like maxSize is
set to the maximum value of uintx (which when cast as a java long would
be Long.MIN_VALUE if I'm not mistaking):

class GCYoungGenerationConfiguration {
  public:
   bool has_max_size_default_value() const;
   uintx max_size() const;
   uintx min_size() const;
   intx new_ratio() const;
};

I'm not 100% sure that my understanding of the whole thing is correct
here, so please do not hesitate to correct me if it isn't.

Furthermore, I'm unsure whether or not the fact that maxSize is
effectively set to Long.MIN_VALUE is necessarily an issue here (as long
as the code that handles the formatting is fixed, of course): maybe the
value carries a specific meaning I'm unaware of.

I would really appreciate it if someone here is a position to shed some
light on the matter for me.

Thanks!
Frederic

[1] https://bugs.openjdk.org/browse/JDK-8309550
[2]
https://github.com/openjdk/jdk/blob/4a75fd462c002a209201d8bfc8d6c9eb286a7444/src/hotspot/share/gc/shared/gcConfiguration.hpp#L71

--
Frederic Thevenet
Senior Software Engineer - OpenJDK
Red Hat France <https://www.redhat.com>
BAF5 C2D2 0BE0 1715 5EE1 0815 2065 AD47 B326 EB92

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/hotspot-jfr-dev/attachments/20230614/4fe5eefc/attachment.htm>


More information about the hotspot-jfr-dev mailing list