Data is written to end of string passed to IO#sysread instead of beginning
--------------------------------------------------------------------------

                 Key: JRUBY-3019
                 URL: http://jira.codehaus.org/browse/JRUBY-3019
             Project: JRuby
          Issue Type: Bug
            Reporter: Wayne Meissner
            Assignee: Thomas E Enebo


When calling the two-arg variant of IO#sysread, data is appended to the end of 
the string instead of the start.  As a side effect, the string grows by the 
requested amount of bytes each time it is passed into IO#sysread, and the JVM 
can run out of memory.

e.g.
{noformat}
Thread.new {  
  len = 4096
  buf = 0.chr * len    
  loop do
    client = serv.accept
    total = 0
    begin
      loop do
        s = client.sysread(len, buf)
        total += s.length if s
      end
    rescue Exception => ex
      puts "sysread failed total=#{total}: #{ex}"
    end
    puts "client closed total=#{total}"
    client.close
  end
}
{noformat}

-- 
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