OutOfMemoryException while reading from a FIFO
----------------------------------------------
Key: JRUBY-1686
URL: http://jira.codehaus.org/browse/JRUBY-1686
Project: JRuby
Issue Type: Bug
Components: Core Classes/Modules
Environment: JRuby [EMAIL PROTECTED] on Java 1.6.0-u3 on OpenSuSE 10.3
Reporter: Adam Glasgall
The following code:
<pre>
require 'java'
fifo = "testfifo"
def read_message(fifo)
open(fifo, "r") do |input|
length = input.read(4).unpack("N")[0]
input.read(length)
end
end
reader = Thread.new do
loop do
puts read_message(fifo)
end
end
reader.join
</pre>
with another process writing to the fifo "testfifo" causes an
OutOfMemoryException regardless of -Xmx setting.
Stack trace:
Exception in thread "Ruby Thread26564976" java.lang.OutOfMemoryError
at sun.misc.Unsafe.allocateMemory(Native Method)
at java.nio.DirectByteBuffer.<init>(DirectByteBuffer.java:99)
at java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:288)
at sun.nio.ch.Util.getTemporaryDirectBuffer(Util.java:57)
at sun.nio.ch.IOUtil.read(IOUtil.java:205)
at sun.nio.ch.FileChannelImpl.read(FileChannelImpl.java:147)
at org.jruby.util.IOHandlerSeekable.sysread(IOHandlerSeekable.java:306)
at org.jruby.util.IOHandlerJavaIO.read(IOHandlerJavaIO.java:147)
at org.jruby.RubyIO.read(RubyIO.java:1192)
at org.jruby.RubyIOInvoker$read_method_0_0.call(Unknown Source)
at
org.jruby.runtime.CallAdapter$DefaultCallAdapter.call(CallAdapter.java:154)
at
org.jruby.runtime.CallAdapter$DefaultCallAdapter.call(CallAdapter.java:107)
at fifo_pull.closure0(fifo_pull.rb:8)
at fifo_pullBlockclosure0xx1.call(Unknown Source)
at org.jruby.runtime.CompiledBlock.yield(CompiledBlock.java:118)
at org.jruby.runtime.Block.yield(Block.java:225)
at org.jruby.RubyFile.open(RubyFile.java:984)
at org.jruby.RubyFile.open(RubyFile.java:957)
at org.jruby.RubyKernel.open(RubyKernel.java:251)
at org.jruby.RubyKernelInvoker$open_method_1_2.call(Unknown Source)
at
org.jruby.runtime.CallAdapter$DefaultCallAdapter.call(CallAdapter.java:154)
at fifo_pull.read_message__0(fifo_pull.rb:6)
at fifo_pullInvokerread_message__0Fixed1.call(Unknown Source)
at
org.jruby.runtime.CallAdapter$DefaultCallAdapter.call(CallAdapter.java:154)
at
org.jruby.runtime.CallAdapter$DefaultCallAdapter.call(CallAdapter.java:107)
at fifo_pull.closure2(fifo_pull.rb:14)
at fifo_pullBlockclosure2xx1.call(Unknown Source)
at org.jruby.runtime.CompiledBlock.yield(CompiledBlock.java:118)
at org.jruby.runtime.Block.yield(Block.java:225)
at org.jruby.RubyKernel.loop(RubyKernel.java:889)
at org.jruby.RubyKernelInvoker$loop_method_0_0.call(Unknown Source)
at
org.jruby.runtime.CallAdapter$DefaultCallAdapter.call(CallAdapter.java:154)
at
org.jruby.runtime.CallAdapter$DefaultCallAdapter.call(CallAdapter.java:113)
at fifo_pull.closure1(fifo_pull.rb:13)
at fifo_pullBlockclosure1xx1.call(Unknown Source)
at org.jruby.runtime.CompiledBlock.yield(CompiledBlock.java:118)
at org.jruby.runtime.CompiledBlock.call(CompiledBlock.java:97)
at org.jruby.RubyProc.call(RubyProc.java:193)
at org.jruby.RubyProc.call(RubyProc.java:171)
at
org.jruby.internal.runtime.RubyNativeThread.run(RubyNativeThread.java:73)
--
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