logo       

[jruby-user] Super-simple DRb server hangs in JRuby (but not in C Ruby) whe: msg#00167

lang.jruby.user

Subject: [jruby-user] Super-simple DRb server hangs in JRuby (but not in C Ruby) when hit with multiple simultaneous requests

Hi --

I just tried writing a Lucene indexserver running in DRb under JRuby,
and immediately ran into a problem where the server would very quickly
hang if I tried to throw requests at it from more than one client
simultaneously. So, I yanked out all the Lucene stuff to diagnose the
problem, and sure enough, the problem has nothing to do with Lucene
and everything to do with JRuby and DRb. Here's the test code in its
entirety:

------------------------------------------------
# test_server
#!/usr/bin/env jruby
require 'drb'

class PingPong
def ping
"pong"
end
end

DRb.start_service("druby://127.0.0.1:4323", PingPong.new)
DRb.thread.join
-------------------------------------------------
# test_client
#!/usr/bin/env jruby
require 'drb'

pingpong = DRbObject.new(nil, "druby://127.0.0.1:4323")

i = 0
while true
i = i+1
pong = pingpong.ping
puts pong + " " + i.inspect
end
--------------------------------------------------

Everything works OK if I start one test_server process and then one
test_client process. When I start up a second simultaneous
test_client process, though, within a few requests everything comes to
a screeching halt: the server fails to respond to any further
requests. (Killing the clients and starting another doesn't help: the
server's still locked up.)

If I use C Ruby for the server instead of JRuby, though, then
everything works fine.

Am I missing something? Is there a workaround for this problem? Or
is JRuby almost entirely useless for DRb? :-(

Thanks,

-- Scott

---------------------------------------------------------------------
To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise