Stack track explosion when attempting to read from a yet-to-be-accepted server 
socket
-------------------------------------------------------------------------------------

                 Key: JRUBY-3369
                 URL: http://jira.codehaus.org/browse/JRUBY-3369
             Project: JRuby
          Issue Type: Bug
          Components: Core Classes/Modules
    Affects Versions: JRuby 1.1.6
            Reporter: Sam Aaron
            Priority: Trivial


The following recipe will spew out the subsequent stack trace

require 'thread'
require 'socket'

s = TCPServer.new('localhost', 1111)
st = Thread.new(s) do |sock|
  puts sock.gets
end

Exception in thread "Thread-2" java.lang.ClassCastException: 
sun.nio.ch.ServerSocketChannelImpl cannot be cast to 
java.nio.channels.ReadableByteChannel
        at org.jruby.util.io.ChannelStream.refillBuffer(ChannelStream.java:189)
        at org.jruby.util.io.ChannelStream.getline(ChannelStream.java:316)
        at org.jruby.RubyIO.getlineFast(RubyIO.java:750)
        at org.jruby.RubyIO.getline(RubyIO.java:629)
        at org.jruby.RubyIO.gets(RubyIO.java:1795)
        at 
org.jruby.RubyIO$i_method_0_1$RUBYINVOKER$gets.call(org/jruby/RubyIO$i_method_0_1$RUBYINVOKER$gets.gen)
        at 
org.jruby.internal.runtime.methods.JavaMethod$JavaMethodNoBlock.call(JavaMethod.java:62)
        at 
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:226)
        at 
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:203)
        at 
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:260)
        at 
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:75)
        at org.jruby.ast.CallNoArgNode.interpret(CallNoArgNode.java:61)
        at org.jruby.ast.FCallOneArgNode.interpret(FCallOneArgNode.java:36)
        at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:101)
        at 
org.jruby.runtime.InterpretedBlock.evalBlockBody(InterpretedBlock.java:202)
        at org.jruby.runtime.InterpretedBlock.yield(InterpretedBlock.java:190)
        at org.jruby.runtime.BlockBody.call(BlockBody.java:64)
        at org.jruby.runtime.BlockBody.call(BlockBody.java:70)
        at org.jruby.runtime.Block.call(Block.java:116)
        at org.jruby.RubyProc.call(RubyProc.java:205)
        at org.jruby.RubyProc.call(RubyProc.java:187)
        at org.jruby.internal.runtime.RubyRunnable.run(RubyRunnable.java:90)
        at java.lang.Thread.run(Thread.java:619)


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to