Skip to content

Java::JavaLangInvoke::WrongMethodTypeException when using invokedynamic #4148

@andreaseger

Description

@andreaseger

Environment

Provide at least:

  • JRuby version:
> echo $JRUBY_OPTS
-Xcompile.invokedynamic=true --server
>jruby -v
jruby 9.1.5.0 (2.3.1) 2016-09-07 036ce39 OpenJDK 64-Bit Server VM 25.102-b14 on 1.8.0_102-b14 +indy +jit [linux-x86_64]
  • Operating system and platform (e.g. uname -a)
Linux scruffy 4.7.0-1-ARCH #1 SMP PREEMPT Mon Aug 8 22:05:58 CEST 2016 x86_64 GNU/Linux

I'm getting the following errors when running parts of my test suite of a big sinatra application using jruby 9.1.5.0 with invokedynamic enabled. The test suite is running fine without indy.

Please let me know how I can give you more information if needed. In the meantime I'll try to isolate the issue to a smaller part of our codebase.

Expected Behavior

The tests and code to run successfully

Actual Behavior

specs start to fail with the following error. Some of these specs will work if run in isolation. Others fail even if executed alone. I haven't yet been able to figure out a more precise cause as the consistently failing specs are bigger integration specs which touch quite a big surace. But suspect some jiting issue given other specs which work in isolation.

What I find also interesting is that after the error occurs the first time not necessary all following specs fail too. From what I see related codes also fails while other codeparts keep working as intended.

     Failure/Error: Unable to find java.lang.invoke.MethodHandles.explicitCastArgumentsChecks(MethodHandles.java to read failed line

     Java::JavaLangInvoke::WrongMethodTypeException:
       cannot explicitly cast MethodHandle(RubyObjectVar5)Object to (IRubyObject,IRubyObject[],Block)IRubyObject
     # java.lang.invoke.MethodHandles.explicitCastArgumentsChecks(MethodHandles.java:2038)
     # java.lang.invoke.MethodHandles.explicitCastArguments(MethodHandles.java:2026)
     # com.headius.invokebinder.transform.Cast.up(Cast.java:43)
     # com.headius.invokebinder.Binder.invoke(Binder.java:1110)
     # com.headius.invokebinder.Binder.getField(Binder.java:1355)
     # com.headius.invokebinder.Binder.getFieldQuiet(Binder.java:1376)
     # org.jruby.ir.targets.Bootstrap.createAttrReaderHandle(Bootstrap.java:422)
     # org.jruby.ir.targets.Bootstrap.buildAttrHandle(Bootstrap.java:381)
     # org.jruby.ir.targets.InvokeSite.getHandle(InvokeSite.java:197)
     # org.jruby.ir.targets.InvokeSite.invoke(InvokeSite.java:136)
     # org.jruby.internal.runtime.methods.CompiledIRMethod.invokeExact(CompiledIRMethod.java:210)
     # org.jruby.internal.runtime.methods.CompiledIRMethod.call(CompiledIRMethod.java:88)
     # org.jruby.internal.runtime.methods.CompiledIRMethod.call(CompiledIRMethod.java:93)
     # org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:128)
     # org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:189)
     # org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:318)
     # org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:131)
     # org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:340)
     # org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:73)
     # org.jruby.ir.interpreter.InterpreterEngine.interpret(InterpreterEngine.java:84)
     # org.jruby.internal.runtime.methods.MixedModeIRMethod.INTERPRET_METHOD(MixedModeIRMethod.java:179)
     # org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:165)
     # org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:197)
     # org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:338)
     # org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:163)
     # org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:315)
     # org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:73)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions