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

Included Timeout crashes when module method version of timeout used #3129

Closed
kaiserprogrammer opened this Issue Jul 10, 2015 · 1 comment

Comments

Projects
None yet
2 participants
@kaiserprogrammer

kaiserprogrammer commented Jul 10, 2015

require "rmodbus"
ModBus::TCPClient.connect("localhost", 502)

results in the following exception:

Timeout.java:299:in `getClassFrom': java.lang.ClassCastException: org.jruby.RubyObject cannot be cast to org.jruby.RubyModule
    from Timeout.java:295:in `getAnonymousException'
    from Timeout.java:158:in `timeout'
    from Timeout$INVOKER$s$timeout.gen:-1:in `call'
    from JavaMethod.java:575:in `call'
    from CachingCallSite.java:273:in `cacheAndCall'
    from CachingCallSite.java:79:in `callBlock'
    from CachingCallSite.java:83:in `call'
    from CallBase.java:419:in `interpret'
    from InterpreterEngine.java:321:in `processCall'
    from StartupInterpreterEngine.java:77:in `interpret'
    from MixedModeIRMethod.java:129:in `INTERPRET_METHOD'
    from MixedModeIRMethod.java:115:in `call'
    from CachingCallSite.java:273:in `cacheAndCall'
    from CachingCallSite.java:79:in `callBlock'
    from CachingCallSite.java:83:in `call'
    from CallBase.java:419:in `interpret'
    from InterpreterEngine.java:321:in `processCall'
    from StartupInterpreterEngine.java:77:in `interpret'
    from MixedModeIRMethod.java:129:in `INTERPRET_METHOD'
    from MixedModeIRMethod.java:115:in `call'
    from CachingCallSite.java:273:in `cacheAndCall'
    from CachingCallSite.java:79:in `callBlock'
    from CachingCallSite.java:83:in `call'
    from CallBase.java:419:in `interpret'
    from InterpreterEngine.java:321:in `processCall'
    from StartupInterpreterEngine.java:77:in `interpret'
    from InterpreterEngine.java:88:in `interpret'
    from MixedModeIRMethod.java:234:in `INTERPRET_METHOD'
    from MixedModeIRMethod.java:220:in `call'
    from CachingCallSite.java:343:in `cacheAndCall'
    from CachingCallSite.java:205:in `callBlock'
    from CachingCallSite.java:209:in `call'
    from RubyClass.java:867:in `newInstance'
    from RubyClass$INVOKER$i$newInstance.gen:-1:in `call'
    from JavaMethod.java:328:in `call'
    from AliasMethod.java:66:in `call'
    from CachingCallSite.java:333:in `cacheAndCall'
    from CachingCallSite.java:195:in `call'
    from /home/coder/gist/jruby_bug_test.rb:-1:in `invokeOther5:connect'
    from /home/coder/gist/jruby_bug_test.rb:4:in `RUBY$script'
    from MethodHandle.java:625:in `invokeWithArguments'
    from Compiler.java:111:in `load'
    from Ruby.java:821:in `runScript'
    from Ruby.java:813:in `runScript'
    from Ruby.java:751:in `runNormally'
    from Ruby.java:573:in `runFromMain'
    from Main.java:401:in `doRunFromMain'
    from Main.java:296:in `internalRun'
    from Main.java:225:in `run'
    from Main.java:197:in `main'

@enebo enebo added this to the JRuby 9.0.0.0 milestone Jul 10, 2015

@enebo

This comment has been minimized.

Show comment
Hide comment
@enebo

enebo Jul 10, 2015

Member

Reduced test case:

require 'timeout'

class Foo
  include Timeout

  def foo
    timeout(1, StandardError) { sleep 10 }
  end
end

Foo.new.foo

Simple error. Whoever made this forgot these methods in Timeout could be called as module methods. If I remove the 'include Timeout' it all works because it hits the global 'timeout' method which properly passes in Timeout instance.

This is also broken in JRuby 1.7.x.

Member

enebo commented Jul 10, 2015

Reduced test case:

require 'timeout'

class Foo
  include Timeout

  def foo
    timeout(1, StandardError) { sleep 10 }
  end
end

Foo.new.foo

Simple error. Whoever made this forgot these methods in Timeout could be called as module methods. If I remove the 'include Timeout' it all works because it hits the global 'timeout' method which properly passes in Timeout instance.

This is also broken in JRuby 1.7.x.

@enebo enebo changed the title from Interpreter Exception JRuby-9.0.0.0.rc2 to Included Timeout crashes when module method version of timeout used Jul 10, 2015

@enebo enebo closed this in d2b21c6 Jul 10, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment