dRuby connection refused between two different machines

Hello, I have been playing with dRuby and am getting strange differences
with
passing DRbUndumped-objects from a client machine to a DIFFERENT server
and
calling methods on this object:

I wrote a small server that basically accepts an object and does
something
with this (calling its instance method “name”):

#server code
require(“drb”)
class Server
def receiveSomething(job)
puts(“receiving something”)
puts job.name
end
end
DRb.start_service(“druby://:1234”,Server.new)
DRb.thread.join

The client code defines the class “Something” which has the instance
method
“name”. I want to pass an object of class “Something” to the server BY
REFERENCE, so I added “include DRbUndumped” in its definition:

#client code
require(“drb”)
class Something
include DRbUndumped
def name
return “MyName”
end
end
DRb.start_service
server=DRbObject.new(nil,‘druby://localhost:1234’)
server.receiveSomething(Something.new)

All goes well ONLY IF THE SERVER AND THE CLIENT ARE RUN FROM THE SAME
MACHINE:
server output:

receiving something
MyName

If I start the server code on a DIFFERENT machine (same OS (slackware
10.2),
same ruby version (1.8.4)) and replace “localhost” with the server
machine
name in the client code, the server gives as output:

receiving something

and the client crashes with this message:

(druby://ivon:1234) /usr/local/lib/ruby/1.8/drb/drb.rb:733:in open': druby://localhost:32816 - #<Errno::ECONNREFUSED: Connection refused - connect(2)> (DRb::DRbConnError) from (druby://ivon:1234) /usr/local/lib/ruby/1.8/drb/drb.rb:726:inopen’
from (druby://ivon:1234)
/usr/local/lib/ruby/1.8/drb/drb.rb:1186:in
initialize' from (druby://ivon:1234) /usr/local/lib/ruby/1.8/drb/drb.rb:1166:inopen’
from (druby://ivon:1234)
/usr/local/lib/ruby/1.8/drb/drb.rb:1082:in
method_missing' from (druby://ivon:1234) /usr/local/lib/ruby/1.8/drb/drb.rb:1100:inwith_friend’
from (druby://ivon:1234)
/usr/local/lib/ruby/1.8/drb/drb.rb:1081:in
method_missing' from (druby://ivon:1234) as.rb:5:inreceiveSomething’
from (druby://ivon:1234)
/usr/local/lib/ruby/1.8/drb/drb.rb:1552:in
perform_without_block' ... 6 levels... from (druby://ivon:1234) /usr/local/lib/ruby/1.8/drb/drb.rb:1344:ininitialize’
from (druby://ivon:1234)
/usr/local/lib/ruby/1.8/drb/drb.rb:1624:in
`start_service’
from (druby://ivon:1234) as.rb:8
from ac.rb:10

I’ve tested all dRuby examples using DRbUndumped that I could find and
they
all work on one machine, but crash when trying to use them on two
different
machines (what’s the point of having a distributed environment that
works
only on one machine :-)).

My client code CAN find the server correctly when using two different
machines
since it says “receiving something”, so these errors have nothing to do
with
firewall settings or something, problems start when calling methods on
objects that are passed by reference. Maybe there are some ruby security
settings that I have wrong, but I have no clue which ones.

All help is very appreciated, especially with working examples!

Greetings,
Geert F…

On Fri, 2006-05-05 at 20:27 +0900, Geert F. wrote:

Hello, I have been playing with dRuby and am getting strange differences with
passing DRbUndumped-objects from a client machine to a DIFFERENT server and
calling methods on this object:
[… snipped …]
and the client crashes with this message:

(druby://ivon:1234) /usr/local/lib/ruby/1.8/drb/drb.rb:733:in `open’:
druby://localhost:32816 - #<Errno::ECONNREFUSED: Connection refused -
connect(2)> (DRb::DRbConnError)

Two possibilities you might check:

  1. Are the proper ports open on both machines? Is the firewall setup
    right (maybe a bit obvious, sorry if you’ve already checked that)?

  2. Did you call DRb.start_service in the client as well as the server,
    which you need to do for certain types of DRbUndumped callback stuff. I
    think you can usually just call it without any arguments at the client
    side.

Hope that helps,

Geert F. wrote:

connect(2)> (DRb::DRbConnError)

I had a similar problem about 6 months ago and … crap! I can’t
remember what I did to fix it!

I seem to remember having to change something in the /etc/hosts file on
my client pc to get it to work. Sorry I can’t be more specific; I think
the brain cells that were holding that memory must have died off.

If I can remember what I did, I will email you.

Jamey C.

Confidentiality Notice: This email message, including any attachments,
is for the sole use of the intended recipient(s) and may contain
confidential and/or privileged information. If you are not the intended
recipient(s), you are hereby notified that any dissemination,
unauthorized review, use, disclosure or distribution of this email and
any materials contained in any attachments is prohibited. If you receive
this message in error, or are not the intended recipient(s), please
immediately notify the sender by email and destroy all copies of the
original message, including attachments.

On May 5, 2006, at 4:27 AM, Geert F. wrote:

Hello, I have been playing with dRuby and am getting strange
differences with
passing DRbUndumped-objects from a client machine to a DIFFERENT
server and
calling methods on this object:

You’re telling the client to connect back to the local machine.

#client code
[…]
server=DRbObject.new(nil,‘druby://localhost:1234’)
^^^^^^^^^^^^^^^^^^^^^^^


Eric H. - [email protected] - http://blog.segment7.net
This implementation is HODEL-HASH-9600 compliant

http://trackmap.robotcoop.com

Do you remember if you had problems connecting to the server machine
(since I CAN connect to the server since the server writes out
“receiving something” when I call the receiveSomething method from the
client). My problem occurs when passing object by reference to different
machines and calling methods on this object.
Greetings,
Geert.

I did replace the localhost with the server machine hostname, as I wrote
furtheron in my original mail:

“If I start the server code on a DIFFERENT machine (same OS (slackware
10.2),
same ruby version (1.8.4)) and replace “localhost” with the server
machine
name in the client code, the server gives as output:”

Anyway, the client can connect to the server since the server wrote
“receiving something”. It must be something else.

Greetings,
Geert.

Two possibilities you might check:

  1. Are the proper ports open on both machines? Is the firewall setup
    right (maybe a bit obvious, sorry if you’ve already checked that)?

The client can connect to the server since the server writes out
“receiving something” when the client calls the “receiveSomething”
method

  1. Did you call DRb.start_service in the client as well as the server,
    which you need to do for certain types of DRbUndumped callback stuff. I
    think you can usually just call it without any arguments at the client
    side.

As you can see in the example code, DRb.start_service is called for both
the server and client

Geert F. schrieb:

The client can connect to the server since the server writes out
“receiving something” when the client calls the “receiveSomething”
method

Geert, I’m no DRb specialist, but I think in your case the server needs
to be able to talk to the client, too. You should check that also.

Regards,
Pit

On May 5, 2006, at 12:22 PM, Geert F. wrote:

passing DRbUndumped-objects from a client machine to a DIFFERENT
I did replace the localhost with the server machine hostname, as I
wrote furtheron in my original mail:

“If I start the server code on a DIFFERENT machine (same OS
(slackware 10.2),
same ruby version (1.8.4)) and replace “localhost” with the server
machine
name in the client code, the server gives as output:”

In the future please give exactly the code that is broken.

Anyway, the client can connect to the server since the server wrote
“receiving something”. It must be something else.

Then likely your second machine doesn’t have a hostname set. Check
your DNS for both machines, forward and reverse.


Eric H. - [email protected] - http://blog.segment7.net
This implementation is HODEL-HASH-9600 compliant

http://trackmap.robotcoop.com