RFR: 8328880: Events::log_exception should limit the size of the logging message
David Holmes
dholmes at openjdk.org
Fri Aug 23 01:33:15 UTC 2024
On Fri, 23 Aug 2024 01:02:29 GMT, Vladimir Kozlov <kvn at openjdk.org> wrote:
>> This simple enhancement allows for `Exceptions::_throw` to limit the message length printed by `Events::log_exception` in the same way that unified logging is limited. We simply allow a `message_length_limit` variable to be passed down - default value zero which means no limit (i.e. the full `strlen` of the message will be printed).
>>
>> Testing:
>> - tiers 1-3
>>
>> Thanks
>
> src/hotspot/share/utilities/events.cpp line 169:
>
>> 167: h_exception->print_value_on(&st);
>> 168: if (message != nullptr) {
>> 169: int len = message_length_limit > 0 ? message_length_limit : (int)strlen(message);
>
> Do we need to check that `message_length_limit <= (int)strlen(message)`?
> Or it is intentional to reserve bigger space in output than `message`?
I don't quite understand the question. We are specifying the maximum number of characters to print: it is either `message_length_limit` if that is > 0 otherwise it is no limit i.e. the whole string i.e. `strlen(message)`.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20638#discussion_r1728105202
More information about the hotspot-dev
mailing list