RFR: 8357402: Crash in AdapterHandlerLibrary::lookup

Ashutosh Mehra asmehra at openjdk.org
Thu May 22 22:25:56 UTC 2025


On Thu, 22 May 2025 21:28:17 GMT, Vladimir Kozlov <kvn at openjdk.org> wrote:

>> See details in the bug report.
>> 
>> The issue is: AOT adapters table `_aot_adapter_handler_table` is accessed during "Assembly" phase when this table is not valid. It happened because the guard in `AdapterHandlerLibrary::lookup()` became invalid after we dumped and close AOT code cache. `AOTCodeCache::is_dumping_adapter()` will return `false` in such case. Instead we should use `AOTCodeCache::is_using_adapter()` check which is valid only during "Production" run when AOT adapters are loaded and `_aot_adapter_handler_table` is valid. I added this guard in all places where the table is accessed.
>> 
>> Because we can't rely on `AOTCodeCache::is_dumping_adapter()` during AOT archive creation I restored `CDSConfig::is_dumping_adapters()` to use instead. `AOTCodeCache::is_dumping_adapter()` check is only used when we  are storing adapters in AOT code cache.
>> 
>> I also noticed the hash clash for some adapters signature (we caught it by comparing recorded and actual signature) and as result we completely bailout AOT code loading. We should not do complete bail out - instead we should just skip this one blob. We are not modifying data in AOT code cache - it is still valid for other code blobs.
>> 
>> tested hs-tier1-10, jck, xcomp, stress
>
>> I think that should not be happening. Can you please create a new issue for this with more details and I can try to see why is that the case.
> 
> @ashu-mehra I remember that I hit the assert in `Method::restore_unshareable_info()` and when I tried to print it gave me garbage:
> 
>  void Method::restore_unshareable_info(TRAPS) {
>    assert(is_method() && is_valid_method(this), "ensure C++ vtable is restored");
>    if (_adapter != nullptr) {
> +    if (!_adapter->is_linked()) _adapter->print_adapter_on(tty);
>      assert(_adapter->is_linked(), "must be");
>      _from_compiled_entry = _adapter->get_c2i_entry();
>    }

@vnkozlov 
> I remember that I hit the assert in Method::restore_unshareable_info()

hmm that's not good. I am not sure how is that possible. If Method is in AOT cache, _adapter should also be there unless it is an `_abstract_method_handler` adapter. And if it is `_abstract_method_handler` then we already clear it during assembly. Is this assert easily reproducible?

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

PR Comment: https://git.openjdk.org/jdk/pull/25398#issuecomment-2902738400


More information about the hotspot-dev mailing list