Details

    • Type: Bug Bug
    • Status: Resolved Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: JRuby 1.7.0.pre1
    • Fix Version/s: JRuby 1.7.0.pre2
    • Component/s: Core Classes/Modules
    • Labels:
      None
    • Environment:
      linux ubuntu, using oracle jre 1.7 update 4
    • Number of attachments :
      0

      Description

      Little background: I have a script that reads emails and puts them in a sqlite database. It's actually a lot of code. I've been running it successfully with ruby 1.8.7 and jruby 1.6 for a while, I'm trying out jruby 1.7 now to test for a ruby 1.9 conversion.

      Here's the stack trace I get. My test case currently consists of everything so I'd rather not post that, but I'd like to provide any other info or testing that's helpful.

      It consistently crashes on processing the fourth email, regardless of the contents of any of them. I guess that's indicative of some jit or other optimization warming up?

      null:-1:in `asType': java.lang.invoke.WrongMethodTypeException: cannot convert MethodHandle(boolean,boolean,boolean,boolean,boolean)boolean to (IRubyObject,IRubyObject,IRubyObject,IRubyObject,IRubyObject)boolean
      from null:-1:in `asSpreaderChecks'
      from null:-1:in `asSpreader'
      from InvokeDynamic.java:354:in `getDirectPointerParameterGuard'
      from InvokeDynamic.java:43:in `getMethodHandle'
      from InvocationLinker.java:1354:in `createFFIHandle'
      from InvocationLinker.java:582:in `handleForMethod'
      from InvocationLinker.java:538:in `tryDispatchDirect'
      from InvocationLinker.java:544:in `getTarget'
      from InvocationLinker.java:214:in `invocationFallback'
      from /home/tedu/proj/sailer/sqlite-ffi.rb:88:in `block_0$RUBY$_for_'
      from rubyjit$SqliteFFI::Statement#execute_6D95D931CFFA7EE9CDFCF40482CE2C8DF50D116226216137$block_0$RUBY$_for_:-1:in `call'
      from CompiledBlock.java:112:in `yield'
      from CompiledBlock.java:95:in `yield'
      from Block.java:130:in `yield'
      from RubyArray.java:1604:in `eachCommon'
      from RubyArray.java:1611:in `each'
      from null:-1:in `invoke_L4'
      from null:-1:in `invoke_L4'
      from /home/tedu/proj/sailer/sqlite-ffi.rb:82:in `_file_'
      from /home/tedu/proj/sailer/sqlite-ffi.rb:-1:in `_file_'
      from JittedMethod.java:101:in `call'
      from /home/tedu/proj/sailer/sqlite-ffi.rb:63:in `_file_'
      from /home/tedu/proj/sailer/sqlite-ffi.rb:-1:in `_file_'
      from JittedMethod.java:101:in `call'
      from CachingCallSite.java:78:in `callBlock'
      from CachingCallSite.java:84:in `call'
      from CallSpecialArgBlockPassNode.java:70:in `interpret'
      from NewlineNode.java:104:in `interpret'
      from ASTInterpreter.java:75:in `INTERPRET_METHOD'
      from InterpretedMethod.java:120:in `call'
      from InterpretedMethod.java:134:in `call'
      from DefaultMethod.java:174:in `call'
      from CachingCallSite.java:69:in `call'
      from CallManyArgsNode.java:59:in `interpret'
      from NewlineNode.java:104:in `interpret'
      from BlockNode.java:71:in `interpret'
      from ASTInterpreter.java:75:in `INTERPRET_METHOD'
      from InterpretedMethod.java:190:in `call'
      from DefaultMethod.java:199:in `call'
      from CachingCallSite.java:167:in `call'
      from CallOneArgNode.java:57:in `interpret'
      from InstAsgnNode.java:95:in `interpret'
      from NewlineNode.java:104:in `interpret'
      from BlockNode.java:71:in `interpret'
      from ASTInterpreter.java:75:in `INTERPRET_METHOD'
      from InterpretedMethod.java:147:in `call'
      from DefaultMethod.java:183:in `call'
      from testimport.rb:42:in `block_0$RUBY$_file_'
      from testimport$block_0$RUBY$_file_:-1:in `call'
      from CompiledBlock19.java:139:in `yield'
      from Block.java:130:in `yield'
      from RubyDir.java:646:in `each'
      from RubyDir.java:538:in `foreachCommon'
      from RubyDir.java:528:in `foreach19'
      from null:-1:in `invoke_L5'
      from null:-1:in `invoke_L5'
      from null:-1:in `invokeWithArguments'
      from InvocationLinker.java:265:in `invocationFallback'
      from testimport.rb:18:in `_file_'
      from testimport.rb:-1:in `load'
      from Ruby.java:778:in `runScript'
      from Ruby.java:771:in `runScript'
      from Ruby.java:648:in `runNormally'
      from Ruby.java:497:in `runFromMain'
      from Main.java:375:in `doRunFromMain'
      from Main.java:264:in `internalRun'
      from Main.java:230:in `run'
      from Main.java:214:in `run'
      from Main.java:194:in `main'

        Issue Links

          Activity

          Hide
          Ted Unangst added a comment -

          Just to confirm, if I use -Xcompile.invokedynamic=false, I make a lot more progress before stopping with an unrelated (likely mine) error.

          Show
          Ted Unangst added a comment - Just to confirm, if I use -Xcompile.invokedynamic=false, I make a lot more progress before stopping with an unrelated (likely mine) error.
          Hide
          Charles Oliver Nutter added a comment -

          Is /home/tedu/proj/sailer/sqlite-ffi.rb:88 something I could see? It would help to know what actual Java method it's calling at that point (it is a Java method call).

          Show
          Charles Oliver Nutter added a comment - Is /home/tedu/proj/sailer/sqlite-ffi.rb:88 something I could see? It would help to know what actual Java method it's calling at that point (it is a Java method call).
          Hide
          Charles Oliver Nutter added a comment -

          I could not reproduce with a trivial example. Need to know better what's happening at that line of code...

          system ~/projects/jruby $ jruby -rjava -e "Java::Blah.blah(true, true, true, true, true)"
          
          system ~/projects/jruby $ jruby -rjava -e "5.times {Java::Blah.blah(true, true, true, true, true)}"
          
          system ~/projects/jruby $ cat Blah.java
          public class Blah {
            public static boolean blah(boolean a, boolean b, boolean c, boolean d, boolean e) {
              return true;
            }
          }
          
          Show
          Charles Oliver Nutter added a comment - I could not reproduce with a trivial example. Need to know better what's happening at that line of code... system ~/projects/jruby $ jruby -rjava -e "Java::Blah.blah(true, true, true, true, true)" system ~/projects/jruby $ jruby -rjava -e "5.times {Java::Blah.blah(true, true, true, true, true)}" system ~/projects/jruby $ cat Blah.java public class Blah { public static boolean blah(boolean a, boolean b, boolean c, boolean d, boolean e) { return true; } }
          Hide
          Ted Unangst added a comment -

          sure, the entire source for that is at https://github.com/tedu/sqlite-ffi/blob/master/sqlite-ffi.rb

          line 88 is SqliteFFI.bind_blob st, argpos, arg, arg.length, -1
          bind_blob is attach_function :bind_blob, :sqlite3_bind_blob, [:pointer, :int, :pointer, :int, :size_t ], :int

          five arguments, but none boolean.

          I have a little time now to try making a smaller test with just that file.

          Show
          Ted Unangst added a comment - sure, the entire source for that is at https://github.com/tedu/sqlite-ffi/blob/master/sqlite-ffi.rb line 88 is SqliteFFI.bind_blob st, argpos, arg, arg.length, -1 bind_blob is attach_function :bind_blob, :sqlite3_bind_blob, [:pointer, :int, :pointer, :int, :size_t ] , :int five arguments, but none boolean. I have a little time now to try making a smaller test with just that file.
          Hide
          Ted Unangst added a comment -

          here's a test case, using the sqlite-ffi binding.

          require "sqlite-ffi"

          dbh = SqliteFFI::Database.new "test.db"
          dbh.execute "create table sss (s text)"
          dbh.execute "create table bbb (b blob)"

          100.times do |i|
          p i
          dbh.execute "insert into sss (s) values ", "hello"
          dbh.execute "insert into bbb (b) values ", "data\0\0stuff"
          end

          That consistently prints numbers up to 24, then crashes with a similar stack trace.

          Show
          Ted Unangst added a comment - here's a test case, using the sqlite-ffi binding. require "sqlite-ffi" dbh = SqliteFFI::Database.new "test.db" dbh.execute "create table sss (s text)" dbh.execute "create table bbb (b blob)" 100.times do |i| p i dbh.execute "insert into sss (s) values ", "hello" dbh.execute "insert into bbb (b) values ", "data\0\0stuff" end That consistently prints numbers up to 24, then crashes with a similar stack trace.
          Hide
          Charles Oliver Nutter added a comment -

          Proactively calling this fixed by the fix for #185 (https://github.com/jruby/jruby/issues/185).

          Show
          Charles Oliver Nutter added a comment - Proactively calling this fixed by the fix for #185 ( https://github.com/jruby/jruby/issues/185 ).
          Hide
          Charles Oliver Nutter added a comment -

          Ted: It turns out there are multiple reports that all have the same backtrace, and #185 should fix it. If you can, please test JRuby head and confirm.

          Show
          Charles Oliver Nutter added a comment - Ted: It turns out there are multiple reports that all have the same backtrace, and #185 should fix it. If you can, please test JRuby head and confirm.

            People

            • Assignee:
              Charles Oliver Nutter
              Reporter:
              Ted Unangst
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: