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

Tobias Hartmann thartmann at openjdk.java.net
Mon Jan 10 07:55:52 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/jdk18/blob/d65c665839c0a564c422ef685f2673fac37315d7/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/jdk18/blob/d65c665839c0a564c422ef685f2673fac37315d7/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:
 - 8279356: Method linking fails with guarantee(mh->adapter() != NULL) failed: Adapter blob must already exist!

Changes: https://git.openjdk.java.net/jdk18/pull/88/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk18&pr=88&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/jdk18/pull/88.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk18 pull/88/head:pull/88

PR: https://git.openjdk.java.net/jdk18/pull/88


More information about the hotspot-dev mailing list