Major divergence in threading behaviour between Ruby 1.8.6 and JRuby 1.1.6
--------------------------------------------------------------------------
Key: JRUBY-3329
URL: http://jira.codehaus.org/browse/JRUBY-3329
Project: JRuby
Issue Type: Bug
Components: Core Classes/Modules
Affects Versions: JRuby 1.1.6
Environment: Ubuntu 8.04, Java 1.6.0_10, x86 32-bit, JRuby 1.1.6
Reporter: Michael T. Richter
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'
--
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