Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: JRuby 1.1.6
-
Fix Version/s: JRuby 1.2
-
Component/s: Core Classes/Modules
-
Labels:None
-
Environment:Ubuntu 8.04, Java 1.6.0_10, x86 32-bit, JRuby 1.1.6
-
Testcase included:yes
-
Number of attachments :
Description
The following very simple test case works in Ruby 1.8.6pl111 and fails in JRuby 1.1.6:
require 'net/telnet'
require 'thread'
puts host=(ARGV[0] || 'london.ginkosoft.com')
puts port=Integer((ARGV[1] || 2007))
server = Net::Telnet.new('Host' => host, 'Port' => port, 'Waittime' => 0.1)
outputthread = Thread.new do
loop do
server.waitfor('Match' => /.*/) {|output| print output}
end
end
loop do
input = STDIN.gets
server.write input
end
outputthread.join
The error when running this with jruby happens after the STDIN.gets call:
java.nio.channels.spi.AbstractSelectableChannel:257:in `configureBlocking': java.nio.channels.IllegalBlockingModeException
from org.jruby.RubyIO:2765:in `select_static'
from org.jruby.RubyIO:2646:in `select'
from org.jruby.RubyIO$s_method_0_3$RUBYINVOKER$select:-1:in `call'
from org.jruby.internal.runtime.methods.JavaMethod$JavaMethodNoBlock:62:in `call'
from org.jruby.internal.runtime.methods.DynamicMethod:261:in `call'
from org.jruby.internal.runtime.methods.DynamicMethod:169:in `call'
from org.jruby.runtime.callsite.CachingCallSite:155:in `call'
from org.jruby.ast.CallTwoArgNode:59:in `interpret'
from org.jruby.ast.NewlineNode:101:in `interpret'
from org.jruby.ast.BlockNode:68:in `interpret'
from org.jruby.ast.WhileNode:128:in `interpret'
from org.jruby.ast.NewlineNode:101:in `interpret'
from org.jruby.ast.BlockNode:68:in `interpret'
from org.jruby.internal.runtime.methods.DefaultMethod:156:in `interpretedCall'
from org.jruby.internal.runtime.methods.DefaultMethod:133:in `call'
from org.jruby.internal.runtime.methods.DefaultMethod:246:in `call'
from org.jruby.runtime.callsite.CachingCallSite:280:in `cacheAndCall'
from org.jruby.runtime.callsite.CachingCallSite:116:in `call'
from junk:17:in `block_3$RUBY$_block_'
from junkBlockCallback$block_3$RUBY$_block_xx1:-1:in `call'
from org.jruby.runtime.CompiledBlock:100:in `yield'
from org.jruby.runtime.Block:120:in `yield'
from org.jruby.RubyKernel:1058:in `loop'
from org.jruby.RubyKernel$s_method_0_0$RUBYFRAMEDINVOKER$loop:-1:in `call'
from org.jruby.runtime.callsite.CachingCallSite:270:in `cacheAndCall'
from org.jruby.runtime.callsite.CachingCallSite:100:in `callIter'
from junk:15:in `_file_'
from junk:-1:in `_file_'
from junk:-1:in `load'
from org.jruby.Ruby:564:in `runScript'
from org.jruby.Ruby:467:in `runNormally'
from org.jruby.Ruby:340:in `runFromMain'
from org.jruby.Main:214:in `run'
from org.jruby.Main:100:in `run'
from org.jruby.Main:84:in `main'
Fixed in 8893... but I really don't have a good test for this. I suppose you'd have to start up a server socket and use this stuff to hit it. If you feel like contributing a simple test, we'd appreciate it (and it would help ensure it doesn't break again).