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

java.nio.channels.IllegalBlockingModeException is raised, instead of ConcurrencyError #1042

Closed
nvloff opened this issue Sep 28, 2013 · 2 comments

Comments

@nvloff
Copy link

nvloff commented Sep 28, 2013

First, let me say that it's pretty stupid use case I have here. Also, I have no idea if seeing Java exceptions is completely normal.

jruby 1.7.4 (1.9.3p392) 2013-05-16 2390d3b on Java HotSpot(TM) 64-Bit Server VM 1.7.0_40-b43 [darwin-x86_64]

I have a test that uses the same socket object in two threads.

Most of the time I get a really nice:

  ConcurrencyError:
       can not set IO blocking after select; concurrent select detected?

However sometimes I get a Java exception:

Exception in thread "RubyThread-5: /Users/nvloff/concurrency_spec.rb:86" java.nio.channels.IllegalBlockingModeException
    at java.nio.channels.spi.AbstractSelectableChannel.register(AbstractSelectableChannel.java:198)
    at org.jruby.util.io.SelectBlob.registerSelect(SelectBlob.java:548)
    at org.jruby.util.io.SelectBlob.trySelectRead(SelectBlob.java:161)
    at org.jruby.util.io.SelectBlob.processReads(SelectBlob.java:133)
    at org.jruby.util.io.SelectBlob.goForIt(SelectBlob.java:63)
    at org.jruby.RubyIO.select_static(RubyIO.java:3486)
    at org.jruby.RubyKernel.select(RubyKernel.java:786)
    at org.jruby.RubyKernel$INVOKER$s$0$3$select.call(RubyKernel$INVOKER$s$0$3$select.gen)
    at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:70)

One problem with java exceptions is that they're not Ruby Exceptions, another problem is that I get warning: singleton on non-persistent Java type
when there is :

rescue
  raise $!.extend(Errors::SocketError)
end

from here in mongoid/moped

@enebo enebo added this to the Invalid or Duplicate milestone May 11, 2016
@enebo
Copy link
Member

enebo commented May 11, 2016

@nvloff can you reopen this if this still happens. We are trying to clean up house but this is pretty old so I don't know where we stand now on this one...

@enebo enebo closed this as completed May 11, 2016
@pcsgithubid
Copy link

after executing the feature spec, it throws the below exception. but
still spec continues and pass

technical stack

jruby 9000
capybara webkit 1.3.0

Finished in 7.94 seconds (files took 12.13 seconds to load)
1 example, 0 failures

java.nio.channels.AsynchronousCloseException
at
java.nio.channels.spi.AbstractInterruptibleChannel.end(AbstractInterruptibleChannel.java:205)
at sun.nio.ch.SourceChannelImpl.read(SourceChannelImpl.java:173)
at org.jruby.RubyIO.transfer(RubyIO.java:4241)
at org.jruby.RubyIO.copy_stream(RubyIO.java:4136)
at
org.jruby.RubyIO$INVOKER$s$0$2$copy_stream.call(RubyIO$INVOKER$s$0$2$copy_stream.gen)
at
org.jruby.internal.runtime.methods.JavaMethod$JavaMethodN.call(JavaMethod.java:693)
at
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:273)
at
org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:79)
at
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:83)
at org.jruby.ir.instructions.CallBase.interpret(CallBase.java:419)
at
org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:321)
at
org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:77)
at
org.jruby.ir.interpreter.Interpreter.INTERPRET_BLOCK(Interpreter.java:136)
at
org.jruby.runtime.InterpretedIRBlockBody.commonYieldPath(InterpretedIRBlockBody.java:118)
at org.jruby.runtime.IRBlockBody.call(IRBlockBody.java:58)
at org.jruby.runtime.Block.call(Block.java:106)
at org.jruby.RubyProc.call(RubyProc.java:324)
at org.jruby.RubyProc.call(RubyProc.java:239)
at org.jruby.internal.runtime.RubyRunnable.run(RubyRunnable.java:99)
at java.lang.Thread.run(Thread.java:745)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants