Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JDK11 OJDK-MH] InternalError: found BindCaller, expected InjectedInvoker #14553

Closed
babsingh opened this issue Feb 17, 2022 · 1 comment · Fixed by #18285
Closed

[JDK11 OJDK-MH] InternalError: found BindCaller, expected InjectedInvoker #14553

babsingh opened this issue Feb 17, 2022 · 1 comment · Fixed by #18285
Labels
jdk11 project:MH Used to track Method Handles related work triageRequired

Comments

@babsingh
Copy link
Contributor

babsingh commented Feb 17, 2022

The below failure(s) is(are) only seen when OJDK MHs are enabled in OpenJ9.

Errors

[2022-02-10T16:31:00.110Z] java.lang.InternalError: java.lang.InternalError: found java.lang.invoke.MethodHandleImpl$BindCaller, expected InjectedInvoker/0x0000000000000000
[2022-02-10T16:31:00.110Z]      at java.base/java.lang.invoke.MethodHandleImpl$BindCaller.checkInjectedInvoker(MethodHandleImpl.java:1270)
[2022-02-10T16:31:00.110Z]      at java.base/java.lang.invoke.MethodHandleImpl$BindCaller.makeInjectedInvoker(MethodHandleImpl.java:1220)
[2022-02-10T16:31:00.110Z]      at java.base/java.lang.invoke.MethodHandleImpl$BindCaller$1.computeValue(MethodHandleImpl.java:1229)
[2022-02-10T16:31:00.110Z]      at java.base/java.lang.invoke.MethodHandleImpl$BindCaller$1.computeValue(MethodHandleImpl.java:1227)
[2022-02-10T16:31:00.110Z]      at java.base/java.lang.ClassValue.getFromHashMap(ClassValue.java:228)
[2022-02-10T16:31:00.110Z]      at java.base/java.lang.ClassValue.getFromBackup(ClassValue.java:210)
[2022-02-10T16:31:00.110Z]      at java.base/java.lang.ClassValue.get(ClassValue.java:116)
[2022-02-10T16:31:00.110Z]      at java.base/java.lang.invoke.MethodHandleImpl$BindCaller.bindCaller(MethodHandleImpl.java:1213)
[2022-02-10T16:31:00.110Z]      at java.base/java.lang.invoke.MethodHandleImpl.bindCaller(MethodHandleImpl.java:1190)
[2022-02-10T16:31:00.110Z]      at java.base/java.lang.invoke.MethodHandles$Lookup.maybeBindCaller(MethodHandles.java:2343)
[2022-02-10T16:31:00.110Z]      at java.base/java.lang.invoke.MethodHandles$Lookup.getDirectMethodCommon(MethodHandles.java:2329)
[2022-02-10T16:31:00.110Z]      at java.base/java.lang.invoke.MethodHandles$Lookup.getDirectMethod(MethodHandles.java:2266)
[2022-02-10T16:31:00.110Z]      at java.base/java.lang.invoke.MethodHandles$Lookup.findStatic(MethodHandles.java:1103)
[2022-02-10T16:31:00.110Z]      at ClassForNameTest.main(ClassForNameTest.java:43)
[2022-02-10T16:31:00.111Z] Caused by: java.lang.InternalError: found java.lang.invoke.MethodHandleImpl$BindCaller, expected InjectedInvoker/0x0000000000000000
[2022-02-10T16:31:00.111Z]      at java.base/java.lang.invoke.MethodHandleImpl$BindCaller.checkCallerClass(MethodHandleImpl.java:1294)
[2022-02-10T16:31:00.111Z]      at java.base/java.lang.invoke.MethodHandleImpl$BindCaller.checkInjectedInvoker(MethodHandleImpl.java:1268)
[2022-02-10T16:31:00.111Z]      ... 19 more
[2022-02-10T16:37:59.291Z] java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
[2022-02-10T16:37:59.291Z]      at indify.Indify.run(Indify.java:130)
[2022-02-10T16:37:59.291Z]      at indify.Indify.main(Indify.java:106)
[2022-02-10T16:37:59.291Z]      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[2022-02-10T16:37:59.291Z]      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[2022-02-10T16:37:59.291Z]      at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[2022-02-10T16:37:59.291Z]      at java.base/java.lang.reflect.Method.invoke(Method.java:566)
[2022-02-10T16:37:59.291Z]      at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:127)
[2022-02-10T16:37:59.291Z]      at java.base/java.lang.Thread.run(Thread.java:871)
[2022-02-10T16:37:59.291Z] Caused by: java.lang.reflect.InvocationTargetException
[2022-02-10T16:37:59.291Z]      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[2022-02-10T16:37:59.291Z]      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[2022-02-10T16:37:59.291Z]      at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[2022-02-10T16:37:59.291Z]      at java.base/java.lang.reflect.Method.invoke(Method.java:566)
[2022-02-10T16:37:59.291Z]      at indify.Indify.runApplication(Indify.java:158)
[2022-02-10T16:37:59.291Z]      at indify.Indify.run(Indify.java:127)
[2022-02-10T16:37:59.291Z]      ... 7 more
[2022-02-10T16:37:59.291Z] Caused by: java.lang.InternalError: java.lang.InternalError: found java.lang.invoke.MethodHandleImpl$BindCaller, expected test.java.lang.invoke.InjectedInvoker/0x000000002c027f60
[2022-02-10T16:37:59.291Z]      at java.base/java.lang.invoke.MethodHandleImpl$BindCaller.checkInjectedInvoker(MethodHandleImpl.java:1270)
[2022-02-10T16:37:59.291Z]      at java.base/java.lang.invoke.MethodHandleImpl$BindCaller.makeInjectedInvoker(MethodHandleImpl.java:1220)
[2022-02-10T16:37:59.291Z]      at java.base/java.lang.invoke.MethodHandleImpl$BindCaller$1.computeValue(MethodHandleImpl.java:1229)
[2022-02-10T16:37:59.291Z]      at java.base/java.lang.invoke.MethodHandleImpl$BindCaller$1.computeValue(MethodHandleImpl.java:1227)
[2022-02-10T16:37:59.291Z]      at java.base/java.lang.ClassValue.getFromHashMap(ClassValue.java:228)
[2022-02-10T16:37:59.291Z]      at java.base/java.lang.ClassValue.getFromBackup(ClassValue.java:210)
[2022-02-10T16:37:59.291Z]      at java.base/java.lang.ClassValue.get(ClassValue.java:116)
[2022-02-10T16:37:59.291Z]      at java.base/java.lang.invoke.MethodHandleImpl$BindCaller.bindCaller(MethodHandleImpl.java:1213)
[2022-02-10T16:37:59.291Z]      at java.base/java.lang.invoke.MethodHandleImpl.bindCaller(MethodHandleImpl.java:1190)
[2022-02-10T16:37:59.291Z]      at java.base/java.lang.invoke.MethodHandles$Lookup.maybeBindCaller(MethodHandles.java:2343)
[2022-02-10T16:37:59.291Z]      at java.base/java.lang.invoke.MethodHandles$Lookup.getDirectMethodCommon(MethodHandles.java:2329)
[2022-02-10T16:37:59.291Z]      at java.base/java.lang.invoke.MethodHandles$Lookup.getDirectMethodNoSecurityManager(MethodHandles.java:2278)
[2022-02-10T16:37:59.291Z]      at java.base/java.lang.invoke.MethodHandles$Lookup.getDirectMethodForConstant(MethodHandles.java:2520)
[2022-02-10T16:37:59.291Z]      at java.base/java.lang.invoke.MethodHandles$Lookup.linkMethodHandleConstant(MethodHandles.java:2466)
[2022-02-10T16:37:59.291Z]      at java.base/java.lang.invoke.MethodHandleNatives.linkMethodHandleConstant(MethodHandleNatives.java:592)
[2022-02-10T16:37:59.291Z]      at java.base/java.lang.invoke.MethodHandleResolver.sendResolveMethodHandle(MethodHandleResolver.java:269)
[2022-02-10T16:37:59.291Z]      at test.java.lang.invoke.MethodHandleConstants.main(MethodHandleConstants.java:58)
[2022-02-10T16:37:59.291Z]      ... 13 more
[2022-02-10T16:37:59.291Z] Caused by: java.lang.InternalError: found java.lang.invoke.MethodHandleImpl$BindCaller, expected test.java.lang.invoke.InjectedInvoker/0x000000002c027f60
[2022-02-10T16:37:59.291Z]      at java.base/java.lang.invoke.MethodHandleImpl$BindCaller.checkCallerClass(MethodHandleImpl.java:1294)
[2022-02-10T16:37:59.291Z]      at java.base/java.lang.invoke.MethodHandleImpl$BindCaller.checkInjectedInvoker(MethodHandleImpl.java:1268)
[2022-02-10T16:37:59.291Z]      ... 29 more

Failing Test Targets

  • BUILD_LIST=openjdk
    • java/lang/invoke/7196190/GetUnsafeTest.java
    • java/lang/invoke/7196190/ClassForNameTest.java
    • jdk/lambda/MethodReferenceTestCallerSensitive.java
    • java/lang/invoke/MethodHandleConstants.java
    • java/lang/StackWalker/CallerSensitiveMethod/Main.java

How-to Run Tests?

https://github.com/eclipse/openj9/blob/master/test/docs/OpenJ9TestUserGuide.md

Steps to build an OpenJ9 JDK11 with OJDK MHs enabled

Refer to #14540.

@babsingh babsingh added project:MH Used to track Method Handles related work triageRequired labels Feb 17, 2022
@babsingh babsingh added the jdk11 label Feb 17, 2022
@ThanHenderson
Copy link
Contributor

ThanHenderson commented Oct 3, 2023

Note: the failures reported above only occur when running with the JTReg testing infrastructure
i.e. (1) via make run-test TEST=<list-of-test-names> or in jenkins.
and not when running the tests individually
i.e. (2) via $BUILD_DIR/images/jdk/bin/java -jar $PROJ_ROOT/jtreg/lib/jtreg.jar -va -jdk:$BUILD_DIR/images/jdk <test-name>

This suggests that the failures reported above are occurring from the infrastructure code. The failures indicated below are from running the each of these reported tests directly with method (2), and there are only two failing tests in this case.

Test: java/lang/invoke/7196190/GetUnsafeTest.java

Produces:

Failed at GetUnsafeTest.java:88
Failed at GetUnsafeTest.java:89
TEST RESULT: Failed. Unexpected exit from test [exit code: 1]

Test: java/lang/invoke/7196190/ClassForNameTest.java

Produces:

java.lang.reflect.InvocationTargetException
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at java.base/java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:710)
        at java.base/java.lang.invoke.MethodHandleImpl$AsVarargsCollector.invokeWithArguments(MethodHandleImpl.java:584)
        at ClassForNameTest.main(ClassForNameTest.java:79)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at com.sun.javatest.regtest.agent.MainWrapper$MainTask.run(MainWrapper.java:138)
        at java.base/java.lang.Thread.run(Thread.java:839)
Caused by: java.lang.ClassNotFoundException: ClassForNameTest
        at java.base/java.lang.Class.forNameImpl(Native Method)
        at java.base/java.lang.Class.forName(Class.java:347)
        ... 13 more

Edit: new issue w.r.t. this comment #18245

ThanHenderson added a commit to ThanHenderson/openj9-openjdk-jdk11 that referenced this issue Oct 10, 2023
This patch fixes both eclipse-openj9#14553 and eclipse-openj9#18245.
The visitAnnotation for Hidden seems to have unwanted side effects
when OJDK MHs are enabled and invokeWithArguments is used in JDK11. The
behaviour when removing the visitAnnotation matches the behaviour of
the RI and the implementation for JDK17.

Closes: eclipse-openj9/openj9#14553 eclipse-openj9/openj9#18245
Signed-off-by: Nathan Henderson <nathan.henderson@ibm.com>
ThanHenderson added a commit to ThanHenderson/openj9-openjdk-jdk11 that referenced this issue Oct 10, 2023
This patch fixes both eclipse-openj9/openj9#14553 and
eclipse-openj9/openj9#18245. The visitAnnotation for Hidden seems to
have unwanted side effects when OJDK MHs are enabled and
invokeWithArguments is used in JDK11. The behaviour when removing the
visitAnnotation matches the behaviour of the RI and the implementation
for JDK17.

Closes: eclipse-openj9/openj9#14553 eclipse-openj9/openj9#18245
Signed-off-by: Nathan Henderson <nathan.henderson@ibm.com>
ThanHenderson added a commit to ThanHenderson/openj9-openjdk-jdk11 that referenced this issue Oct 10, 2023
This patch fixes both eclipse-openj9/openj9#14553 and
eclipse-openj9/openj9#18245. The visitAnnotation for Hidden seems to
have unwanted side effects when OJDK MHs are enabled and
invokeWithArguments is used in JDK11. The behaviour when removing the
visitAnnotation matches the behaviour of the RI and the implementation
for JDK17.

Closes: eclipse-openj9/openj9#14553 eclipse-openj9/openj9#18245
Signed-off-by: Nathan Henderson <nathan.henderson@ibm.com>
ThanHenderson added a commit to ThanHenderson/openj9-openjdk-jdk11 that referenced this issue Oct 10, 2023
This patch fixes both eclipse-openj9/openj9#14553 and
eclipse-openj9/openj9#18245. The visitAnnotation for Hidden seems to
have unwanted side effects when OJDK MHs are enabled and
invokeWithArguments is used in JDK11. The behaviour when removing the
visitAnnotation matches the behaviour of the RI and the implementation
for JDK17.

Closes: eclipse-openj9/openj9#14553 eclipse-openj9/openj9#18245
Signed-off-by: Nathan Henderson <nathan.henderson@ibm.com>
ThanHenderson added a commit to ThanHenderson/openj9 that referenced this issue Oct 19, 2023
This patch fixes both eclipse-openj9#14553 and
eclipse-openj9#18245. When OJDK MHs are enabled for JDK11, the
Hidden attribute for InjectedInvoker classes caused getStackClass and
getCallerClass to return the incorrect class. The solution is to
not iterate over InjectedInvoker classes despite them having the
J9AccMethodFrameIteratorSkip modifier set due to the Hidden attribute.

Closes: eclipse-openj9#14553 eclipse-openj9#18245
Signed-off-by: Nathan Henderson <nathan.henderson@ibm.com>
Adopt OpenJDK MethodHandles automation moved this from To do to Done Oct 20, 2023
midronij pushed a commit to midronij/openj9 that referenced this issue Oct 26, 2023
This patch fixes both eclipse-openj9#14553 and
eclipse-openj9#18245. When OJDK MHs are enabled for JDK11, the
Hidden attribute for InjectedInvoker classes caused getStackClass and
getCallerClass to return the incorrect class. The solution is to
not iterate over InjectedInvoker classes despite them having the
J9AccMethodFrameIteratorSkip modifier set due to the Hidden attribute.

Closes: eclipse-openj9#14553 eclipse-openj9#18245
Signed-off-by: Nathan Henderson <nathan.henderson@ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
jdk11 project:MH Used to track Method Handles related work triageRequired
2 participants