RFR: 8312401: SymbolTable::do_add_if_needed hang when requesting length exceeds max_symbol_length [v3]

Ioi Lam iklam at openjdk.org
Tue Jul 25 02:23:53 UTC 2023


On Mon, 24 Jul 2023 17:33:12 GMT, Jiangli Zhou <jiangli at openjdk.org> wrote:

>> Please review the simple fix to resolve infinite loop in SymbolTable::do_add_if_needed caused by extra long symbol string that exceeds Symbol::max_length(). See JDK-8312401 for details.
>> 
>> The jtreg test is converted from a test case constructed by @cushon.
>
> Jiangli Zhou has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Revert the change that truncates the string in String::as_symbol.

Changes requested by iklam (Reviewer).

src/hotspot/share/classfile/symbolTable.cpp line 340:

> 338: 
> 339: Symbol* SymbolTable::new_symbol(const char* name, int len) {
> 340:   assert(len <= Symbol::max_length(), "sanity");

There are other calls to `java_lang_Throwable::detail_message()` that will overflow `Symbol::max_length()`, so adding this assert will just change the hang into a crash, neither is desirable.

If we want to properly fix `java_lang_Throwable::detail_message()` in a future RFE, it's better to temporarily change `java_lang_Throwable::detail_message()` in this PR to truncate the string (instead of hanging). That's a better alternative than crashing or hanging.

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

PR Review: https://git.openjdk.org/jdk/pull/14938#pullrequestreview-1544524218
PR Review Comment: https://git.openjdk.org/jdk/pull/14938#discussion_r1272925558


More information about the hotspot-runtime-dev mailing list