Open headius opened 4 years ago
@mahaswami If you could run your reproduction script while also passing -Xbacktrace.style=full
I suspect we will confirm my theory. The trace should bottom out in an arity check triggered by an IRubyObject[]
call from one of the invokedynamic InvokeSite classes in JRuby.
This affects ARJDBC 1.3 only. Versions 50+ were already patched as described below.
Transplanted from https://github.com/jruby/jruby/issues/6191#issuecomment-624282547
I believe the ArgumentError may be a bug in ar-jdbc 1.3.x exposed by indy.
Looking at the implementation of
execute_query_raw
in ar-jdbc:https://github.com/jruby/activerecord-jdbc-adapter/blob/1-3-stable/src/java/arjdbc/jdbc/RubyJdbcConnection.java#L771-L788
We can see here that one definition sets up
required = 1
and the other sets uprequired = 2
. When we have bindings that conflict on the number of required arguments like this, we may end up with unpredictable behavior.In your case, when invokedynamic is enabled, we call along the
IRubyObject[]
path (at least until the indy call optimizes) which requires two arguments. This is similar to other bugs we've seen where the varargs form of a "native" method does not handle the smaller arities.The code below should patch this issue for ar-jdbc 1.3 but I have not worked on that branch in a long time. I'd need assistance from @kares or @enebo to test and/or release such a change.