History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: JRUBY-2307
Type: Bug Bug
Status: Open Open
Priority: Major Major
Assignee: Unassigned
Reporter: Sean Carr
Votes: 0
Watchers: 2
Operations

If you were logged in you would be able to see more operations.
JRuby

DRb from MRI server to JRuby client fails with long messages

Created: 20/Mar/08 06:05 PM   Updated: 20/Mar/08 06:59 PM
Component/s: Core Classes/Modules
Affects Version/s: JRuby 1.1RC2
Fix Version/s: None

Time Tracking:
Not Specified

Environment: Mac OS X 10.4, JRuby 1.1RC2, Ruby 1.8.6


 Description  « Hide
DRb Server
require 'drb'
class TestServer
  def get_string(size)
    "1" * size
  end
end
server = TestServer.new
DRb.start_service('druby://localhost:12345', server)
DRb.thread.join

DRb Client

require 'drb'
obj = DRbObject.new(nil, 'druby://localhost:12345')
[1007, 1008].each do |n|
  begin
    obj.get_string(n)
    puts "Worked with size #{n}"
  rescue Exception => e
    puts "Exception with size #{n}: #{e.inspect}"
  end
end
    SERVER  
    MRI JRuby
CLIENT MRI works works
  JRuby breaks at 1008 works

Both 1007 and 1008 work fine in unless the server is running in MRI and the client is running in JRuby. In that case, sending a string of 1008 characters causes this exception on the JRuby client:
DRb::DRbConnError: premature marshal format(can't read)
from /usr/local/jruby/lib/ruby/1.8/drb/drb.rb:580:in `load'
from /usr/local/jruby/lib/ruby/1.8/drb/drb.rb:633:in `recv_reply'
from /usr/local/jruby/lib/ruby/1.8/drb/drb.rb:921:in `recv_reply'
from /usr/local/jruby/lib/ruby/1.8/drb/drb.rb:1195:in `send_message'
from /usr/local/jruby/lib/ruby/1.8/drb/drb.rb:1086:in `method_missing'
from /usr/local/jruby/lib/ruby/1.8/drb/drb.rb:1085:in `open'
from /usr/local/jruby/lib/ruby/1.8/drb/drb.rb:1159:in `method_missing'
from /usr/local/jruby/lib/ruby/1.8/drb/drb.rb:1085:in `with_friend'
from /usr/local/jruby/lib/ruby/1.8/drb/drb.rb:1084:in `method_missing'
from /usr/local/jruby/lib/ruby/1.8/drb/drb.rb:1085:in `puts'

This example is much simplified from my original problem which involved sending other objects. It seems that the problem is related to the size of the marshalled data, not what the data is. One thing to note though is that occasionally sending 1008 characters will work just fine. This is a small percentage of the time but it does happen.



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Sean Carr - 20/Mar/08 06:29 PM
still an issue in JRuby 1.1RC3

Sean Carr - 20/Mar/08 06:59 PM
These numbers only seem to apply when running the client in jirb. When running the client via command line with jruby the tipping point seems to be much higher and even so the exception is less frequent. The bigger it gets the more frequent the error. At 10k it happened only a couple percent of the time but at 100k it happens a majority of the time.