RFR: 8338888: SystemDictionary::class_name_symbol has incorrect length check

Thomas Stuefe stuefe at openjdk.org
Tue Aug 27 13:16:03 UTC 2024


On Tue, 27 Aug 2024 07:57:14 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> It could ... but that limit of `fthrow` is not really part of the API or exposed. It is also a somewhat arbitrary VM limit and the same kind of check in Java code would just include the complete name regardless of size (limited to `int_max` latin1 characters of course). Even at 64K you may want to see why your class name is unexpectedly longer than you thought. And for other callers of this API the truncation applied by `fthrow` might be considered a bug as it would impede debugging.
>> 
>> I wanted to avoid the `os::vsnprintf` problem without imposing any other policy choice here.
>
> PS. Thanks for taking a look!

I get what you mean, but then, we should take the limit you impose here (print_limit) at face value and act as if Exceptions::fthrow would not impose any limits (since we cannot know them since they are implementation details).

So, again there is the question if we want to pay 2 GB (multiple times, since we need a buffer for vsprintf to assemble it, then memory in java heap for the resulting j.l.String). Something akin to your log messages where we omit the middle of the string may serve us here as well. Or, just a bigger but still reasonable limit (e.g. 512 KB).

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20709#discussion_r1732830300


More information about the hotspot-runtime-dev mailing list