RFR: 8338888: SystemDictionary::class_name_symbol has incorrect length check
David Holmes
dholmes at openjdk.org
Tue Aug 27 08:03:03 UTC 2024
On Tue, 27 Aug 2024 05:46:13 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:
>> Do you really want to throw an exception with a message length of up to 2 GB? This may find its way into logfiles etc. Even printing out 64K worth of name may be a bit much.
>
> But `Exceptions::fthrow` truncates at 1024 bytes anyway, which I think is absolutely fine. So the print_limit could just be 1024.
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.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20709#discussion_r1732334041
More information about the hotspot-runtime-dev
mailing list