RFR: 8279356: Method linking fails with guarantee(mh->adapter() != NULL) failed: Adapter blob must already exist!

Tobias Hartmann thartmann at openjdk.java.net
Fri Jan 7 17:03:59 UTC 2022


Adapter creation during method linking may fail due to a lack of code cache space which leads to a `VirtualMachineError` being thrown and thus a bail out from linking the holder klass:
https://github.com/openjdk/jdk/blob/4243f4c998344e77dccd4d5605e56e869bc8af89/src/hotspot/share/oops/method.cpp#L1239-L1247

If the `VirtualMachineError` is handled/ignored by the application, we may later attempt to link the same klass and therefore also the same method again. We then incorrectly bail out from adapter creation because the `_i2i_entry` is set, assuming that this can only happen if adapters have already been created. However, that is not guaranteed because the interpreter entry is set right **before** adapters are created:
https://github.com/openjdk/jdk/blob/4243f4c998344e77dccd4d5605e56e869bc8af89/src/hotspot/share/oops/method.cpp#L1213-L1230

I propose to instead check if adapters have been created.

This is an old bug that was just recently triggered by an unrelated change.

Thanks,
Tobias

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

Commit messages:
 - Test fix #2
 - Fixed test issue
 - 8279356: Method linking fails with guarantee(mh->adapter() != NULL) failed: Adapter blob must already exist!

Changes: https://git.openjdk.java.net/jdk/pull/6990/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=6990&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8279356
  Stats: 52 lines in 2 files changed: 43 ins; 2 del; 7 mod
  Patch: https://git.openjdk.java.net/jdk/pull/6990.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/6990/head:pull/6990

PR: https://git.openjdk.java.net/jdk/pull/6990


More information about the hotspot-dev mailing list