Serious NIO-multithreading breakage in print/puts on Windows
------------------------------------------------------------
Key: JRUBY-2023
URL: http://jira.codehaus.org/browse/JRUBY-2023
Project: JRuby
Issue Type: Bug
Components: Core Classes/Modules
Affects Versions: JRuby 1.1RC1
Environment: Latest JRuby 1.1RC1
Reporter: Vladimir Sizikov
Priority: Blocker
This very simple script breaks hard on Windows platform:
{noformat}
threads = []
100.times {
threads << Thread.new { puts "." }
}
threads.each { |t| t.join }
{noformat}
MRI would just print 100 dots, while JRuby fails:
Exception in thread "Ruby Thread24607203" java.nio.BufferUnderflowException
at java.nio.HeapByteBuffer.get(HeapByteBuffer.java:127)
at
java.nio.channels.Channels$WritableByteChannelImpl.write(Channels.java:272)
at
org.jruby.util.IOHandlerNioBuffered.flushWrite(IOHandlerNioBuffered.java:290)
at
org.jruby.util.IOHandlerNioBuffered.sync(IOHandlerNioBuffered.java:416)
at
org.jruby.util.IOHandlerNioBuffered.bufferedWrite(IOHandlerNioBuffered.java:598)
at
org.jruby.util.IOHandlerNioBuffered.write(IOHandlerNioBuffered.java:702)
at org.jruby.RubyIO.write(RubyIO.java:858)
at org.jruby.RubyIOInvoker$write_method_1_0.call(Unknown Source)
at
org.jruby.internal.runtime.methods.JavaMethod$JavaMethodOne.call(JavaMethod.java:120)
at org.jruby.RubyClass.invoke(RubyClass.java:239)
at
org.jruby.javasupport.util.RuntimeHelpers.invoke(RuntimeHelpers.java:343)
at org.jruby.RubyObject.callMethod(RubyObject.java:463)
at org.jruby.RubyIO.puts(RubyIO.java:1361)
at org.jruby.RubyIOInvoker$puts_method_0_0.call(Unknown Source)
at
org.jruby.internal.runtime.methods.JavaMethod$JavaMethodNoBlock.call(JavaMethod.java:63)
at org.jruby.RubyClass.invoke(RubyClass.java:239)
at
org.jruby.javasupport.util.RuntimeHelpers.invoke(RuntimeHelpers.java:343)
at org.jruby.RubyObject.callMethod(RubyObject.java:466)
at org.jruby.RubyKernel.puts(RubyKernel.java:380)
at org.jruby.RubyKernelInvoker$puts_method_0_0.call(Unknown Source)
at
org.jruby.internal.runtime.methods.JavaMethod$JavaMethodNoBlock.call(JavaMethod.java:63)
at
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:77)
at
org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:358)
at ruby.D_3a_.threads_minus_nio_dot_rb.closure1(threads-nio.rb:3)
at ruby.D_3a_.threads_minus_nio_dot_rbBlockclosure1xx1.call(Unknown
Source)
at
org.jruby.runtime.CompiledBlockLight.yield(CompiledBlockLight.java:108)
at org.jruby.runtime.CompiledBlockLight.call(CompiledBlockLight.java:84)
at org.jruby.runtime.Block.call(Block.java:105)
at org.jruby.RubyProc.call(RubyProc.java:204)
at org.jruby.RubyProc.call(RubyProc.java:182)
at
org.jruby.internal.runtime.RubyNativeThread.run(RubyNativeThread.java:72)
This is reproducible only on Windows (works fine on Linux), which is bad,
because it means
we have some platform-specific behavior.
--
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