DRb connection issues

K

Kevin Brown

This is not a DRb problem, so much as a system configuration problem. I know
this already, but I can't figure out why DRb will not connect. I have two
machines, plugged into a switch, and both have static IPs. I have had DRb
talking just fine before, but only for a while, so I'm not sure why it won't
talk now, and I thought I had already solved the problem by placing the
whatever.fylz.com before localhost.localdomain in the /etc/hosts files. I
have not rebooted either machine (but it was overnight), so I do not know now
why they DRb will not talk.

The problem seems to be name resolution, so I'm playing around with /etc/hosts
to see if I can get us to talk.

I'm using the dchats.rb and dchatc.rb included with the DRb examples. I start
the server on one machine (called costarica) and see this:

kevin@costarica:~/drbsample$ ruby dchats.rb
druby://costarica.fylz.com:1242
[return] to exit.

I start the client on the other machine (called nicaragua) and see this:

kevin@nicaragua:~/ruby/drb$ ruby dchatc.rb druby://costarica.fylz.com:1242
kevin
(druby://costarica.fylz.com:1242) /usr/lib/ruby/1.8/drb/drb.rb:733:in `open':
druby://nicaragua.fylz.com:39879 - #<Errno::ECONNREFUSED: Connection refused
- connect(2)> (DRb::DRbConnError)
from
(druby://costarica.fylz.com:1242) /usr/lib/ruby/1.8/drb/drb.rb:726:in `each'
from
(druby://costarica.fylz.com:1242) /usr/lib/ruby/1.8/drb/drb.rb:726:in `open'
from
(druby://costarica.fylz.com:1242) /usr/lib/ruby/1.8/drb/drb.rb:1185:in
`initialize'
from
(druby://costarica.fylz.com:1242) /usr/lib/ruby/1.8/drb/drb.rb:1165:in `new'
from
(druby://costarica.fylz.com:1242) /usr/lib/ruby/1.8/drb/drb.rb:1165:in `open'
from
(druby://costarica.fylz.com:1242) /usr/lib/ruby/1.8/drb/drb.rb:1082:in
`method_missing'
from
(druby://costarica.fylz.com:1242) /usr/lib/ruby/1.8/drb/drb.rb:1081:in
`with_friend'
from
(druby://costarica.fylz.com:1242) /usr/lib/ruby/1.8/drb/drb.rb:1081:in
`method_missing'
from (druby://costarica.fylz.com:1242) dchats.rb:14:in `initialize'
from (druby://costarica.fylz.com:1242) dchats.rb:37:in `new'
from (druby://costarica.fylz.com:1242) dchats.rb:37:in `add_member'
from dchatc.rb:37

I can ping both machines by name from each other just fine:
kevin@nicaragua:~/ruby/drb$ ping costarica
PING costarica.fylz.com (192.168.2.105) 56(84) bytes of data.
64 bytes from costarica.fylz.com (192.168.2.105): icmp_seq=1 ttl=64 time=0.226
ms

kevin@costarica:~/drbsample$ ping nicaragua
PING nicaragua.fylz.com (192.168.2.102) 56(84) bytes of data.
64 bytes from nicaragua.fylz.com (192.168.2.102): icmp_seq=1 ttl=64 time=0.206
ms

Both know their host name:
kevin@nicaragua:~/ruby/drb$ hostname
nicaragua.fylz.com

kevin@costarica:~/drbsample$ hostname
costarica.fylz.com

And here are the contents of both of their /etc/hosts files:

kevin@nicaragua:~/ruby/drb$ cat /etc/hosts
127.0.0.1 nicaragua.fylz.com localhost.localdomain localhost
nicaragua
198.186.207.1 router
198.186.207.11 myradio
198.186.207.2 fylradio
192.168.0.1 vsat
192.168.2.103 dualie

# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

192.168.2.105 costarica.fylz.com costarica
192.168.2.102 nicaragua.fylz.com nicaragua

kevin@costarica:~/drbsample$ cat /etc/hosts
127.0.0.1 costarica.fylz.com localhost.localdomain localhost
costarica

# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

192.168.2.105 costarica.fylz.com costarica
192.168.2.102 nicaragua.fylz.com nicaragua

The server (costarica) is running Debian Sarge and the client is on Kubuntu
Hoary. Does anyone have any idea why I see the above error? I certainly
don't.
 
K

Kevin Brown

Thanks for the reply!

[...]
Your ping host names and druby URI host names do not match. Try ping
with the full host name.

kevin@nicaragua:~$ ping costarica.fylz.com
PING costarica.fylz.com (192.168.2.105) 56(84) bytes of data.
64 bytes from costarica.fylz.com (192.168.2.105): icmp_seq=1 ttl=64 time=0.317
ms

kevin@costarica:~$ ping nicaragua.fylz.com
PING nicaragua.fylz.com (192.168.2.102) 56(84) bytes of data.
64 bytes from nicaragua.fylz.com (192.168.2.102): icmp_seq=1 ttl=64 time=0.183
ms
On each machine try:
$ ruby -rsocket -e 'p Socket.gethostname'
"kaa.coop.robotcoop.com
$ ruby -rsocket -e 'p Socket.gethostbyname("kaa.coop.robotcoop.com")'
["kaa.coop.robotcoop.com", [], 2, "\300\250\001F"]
$ ruby -rsocket -e 'p Socket.gethostbyaddr("\300\250\001F")'
["kaa.coop.robotcoop.com", [], 2, "\300\250\001F"]
$ ruby -rsocket -e 'p Socket.gethostbyname("rur-1.coop.robotcoop.com")'
["rur-1.coop.robotcoop.com", [], 2, "\300\250\001\v"]
$ ruby -rsocket -e 'p Socket.gethostbyaddr("\300\250\001\v")'
["rur-1.coop.robotcoop.com", [], 2, "\300\250\001\v"]

Where 'kaa.coop.robotcoop.com' is the local machine and
'rur-1.coop.robotcoop.com' is the remote machine.

== Server ==
kevin@costarica:~$ ruby -rsocket -e 'p Socket.gethostname'
"costarica.fylz.com"

kevin@costarica:~$ ruby -rsocket -e 'p
Socket.gethostbyname("costarica.fylz.com")'
["costarica.fylz.com", ["localhost.localdomain", "localhost", "costarica",
"costarica"], 2, "\177\000\000\001", "\300\250\002i"]

kevin@costarica:~$ ruby -rsocket -e 'p Socket.gethostbyaddr("\300\250\002i")'
["costarica.fylz.com", ["costarica"], 2, "\300\250\002i"]

kevin@costarica:~$ ruby -rsocket -e 'p
Socket.gethostbyname("nicaragua.fylz.com")'
["nicaragua.fylz.com", ["nicaragua"], 2, "\300\250\002f"]

kevin@costarica:~$ ruby -rsocket -e 'p Socket.gethostbyaddr("\300\250\002f")'
["nicaragua.fylz.com", ["nicaragua"], 2, "\300\250\002f"]

== Client ==
kevin@nicaragua:~$ ruby -rsocket -e 'p Socket.gethostname'
"nicaragua.fylz.com"

kevin@nicaragua:~$ ruby -rsocket -e 'p
Socket.gethostbyname("nicaragua.fylz.com")'
["nicaragua.fylz.com", ["localhost.localdomain", "localhost", "nicaragua",
"nicaragua"], 2, "\177\000\000\001", "\300\250\002f"]

kevin@nicaragua:~$ ruby -rsocket -e 'p Socket.gethostbyaddr("\300\250\002f")'
["nicaragua.fylz.com", ["nicaragua"], 2, "\300\250\002f"]

kevin@nicaragua:~$ ruby -rsocket -e 'p
Socket.gethostbyname("costarica.fylz.com")'
["costarica.fylz.com", ["costarica"], 2, "\300\250\002i"]

kevin@nicaragua:~$ ruby -rsocket -e 'p Socket.gethostbyaddr("\300\250\002i")'
["costarica.fylz.com", ["costarica"], 2, "\300\250\002i"]

Line 1 should match `hostname`

It does.
Lines 2 and 3 should be identical

They're obviously not. So what do I change to get them to be?
Lines 4 and 5 should be identical

They are.
In lines 2 through 5 the last item should not match:
"\177\000\000\001"

It's not the last item, but is there.

And just to make sure that it's still happening, I tried running the dchats
and dchatc programs again and got the same error.
Note:

"\177\000\000\001".scan(/./).map { |c| c[0] }.join '.'
=> "127.0.0.1"

Makes sense.
 
E

Eric Hodel

[...]
Your ping host names and druby URI host names do not match. Try ping
with the full host name.

== Server ==
kevin@costarica:~$ ruby -rsocket -e 'p Socket.gethostname'
"costarica.fylz.com"

kevin@costarica:~$ ruby -rsocket -e 'p
Socket.gethostbyname("costarica.fylz.com")'
["costarica.fylz.com", ["localhost.localdomain", "localhost",
"costarica",
"costarica"], 2, "\177\000\000\001", "\300\250\002i"]

kevin@costarica:~$ ruby -rsocket -e 'p Socket.gethostbyaddr("\300
\250\002i")'
["costarica.fylz.com", ["costarica"], 2, "\300\250\002i"]

kevin@costarica:~$ ruby -rsocket -e 'p
Socket.gethostbyname("nicaragua.fylz.com")'
["nicaragua.fylz.com", ["nicaragua"], 2, "\300\250\002f"]

kevin@costarica:~$ ruby -rsocket -e 'p Socket.gethostbyaddr("\300
\250\002f")'
["nicaragua.fylz.com", ["nicaragua"], 2, "\300\250\002f"]

== Client ==
kevin@nicaragua:~$ ruby -rsocket -e 'p Socket.gethostname'
"nicaragua.fylz.com"

kevin@nicaragua:~$ ruby -rsocket -e 'p
Socket.gethostbyname("nicaragua.fylz.com")'
["nicaragua.fylz.com", ["localhost.localdomain", "localhost",
"nicaragua",
"nicaragua"], 2, "\177\000\000\001", "\300\250\002f"]

kevin@nicaragua:~$ ruby -rsocket -e 'p Socket.gethostbyaddr("\300
\250\002f")'
["nicaragua.fylz.com", ["nicaragua"], 2, "\300\250\002f"]

kevin@nicaragua:~$ ruby -rsocket -e 'p
Socket.gethostbyname("costarica.fylz.com")'
["costarica.fylz.com", ["costarica"], 2, "\300\250\002i"]

kevin@nicaragua:~$ ruby -rsocket -e 'p Socket.gethostbyaddr("\300
\250\002i")'
["costarica.fylz.com", ["costarica"], 2, "\300\250\002i"]

Line 1 should match `hostname`

It does.
Lines 2 and 3 should be identical

They're obviously not. So what do I change to get them to be?
Lines 4 and 5 should be identical

They are.
In lines 2 through 5 the last item should not match:
"\177\000\000\001"

It's not the last item, but is there.

Maybe try:

127.0.0.1 localhost.localdomain localhost
192.168.2.105 costarica.fylz.com costarica
192.168.2.102 nicaragua.fylz.com nicaragua

in your /etc/hosts.
 
K

Kevin Brown

--just curious, what do you get when running this command:

root# hostname --fqdn

This is before the modifications that Eric so kindly gave that I will try
next. :)

root@nicaragua:/home/kevin # hostname --fqdn
nicaragua.fylz.com

costarica:/home/kevin# hostname --fqdn
costarica.fylz.com

Looks kosher, no?
Thx

]
Your ping host names and druby URI host names do not match. Try ping
with the full host name.

== Server ==
kevin@costarica:~$ ruby -rsocket -e 'p Socket.gethostname'
"costarica.fylz.com"

kevin@costarica:~$ ruby -rsocket -e 'p
Socket.gethostbyname("costarica.fylz.com")'
["costarica.fylz.com", ["localhost.localdomain", "localhost",
"costarica",
"costarica"], 2, "\177\000\000\001", "\300\250\002i"]

kevin@costarica:~$ ruby -rsocket -e 'p Socket.gethostbyaddr("\300
\250\002i")'
["costarica.fylz.com", ["costarica"], 2, "\300\250\002i"]

kevin@costarica:~$ ruby -rsocket -e 'p
Socket.gethostbyname("nicaragua.fylz.com")'
["nicaragua.fylz.com", ["nicaragua"], 2, "\300\250\002f"]

kevin@costarica:~$ ruby -rsocket -e 'p Socket.gethostbyaddr("\300
\250\002f")'
["nicaragua.fylz.com", ["nicaragua"], 2, "\300\250\002f"]

== Client ==
kevin@nicaragua:~$ ruby -rsocket -e 'p Socket.gethostname'
"nicaragua.fylz.com"

kevin@nicaragua:~$ ruby -rsocket -e 'p
Socket.gethostbyname("nicaragua.fylz.com")'
["nicaragua.fylz.com", ["localhost.localdomain", "localhost",
"nicaragua",
"nicaragua"], 2, "\177\000\000\001", "\300\250\002f"]

kevin@nicaragua:~$ ruby -rsocket -e 'p Socket.gethostbyaddr("\300
\250\002f")'
["nicaragua.fylz.com", ["nicaragua"], 2, "\300\250\002f"]

kevin@nicaragua:~$ ruby -rsocket -e 'p
Socket.gethostbyname("costarica.fylz.com")'
["costarica.fylz.com", ["costarica"], 2, "\300\250\002i"]

kevin@nicaragua:~$ ruby -rsocket -e 'p Socket.gethostbyaddr("\300
\250\002i")'
["costarica.fylz.com", ["costarica"], 2, "\300\250\002i"]

Line 1 should match `hostname`

It does.

Lines 2 and 3 should be identical

They're obviously not. So what do I change to get them to be?

Lines 4 and 5 should be identical

They are.

In lines 2 through 5 the last item should not match:
"\177\000\000\001"

It's not the last item, but is there.

And here are the contents of both of their /etc/hosts files:

kevin@nicaragua:~/ruby/drb$ cat /etc/hosts
127.0.0.1 nicaragua.fylz.com localhost.localdomain
localhost
nicaragua

Maybe try:

127.0.0.1 localhost.localdomain localhost
192.168.2.105 costarica.fylz.com costarica
192.168.2.102 nicaragua.fylz.com nicaragua

in your /etc/hosts.

--
Eric Hodel - (e-mail address removed) - http://segment7.net
This implementation is HODEL-HASH-9600 compliant

http://trackmap.robotcoop.com
 
K

Kevin Brown

Maybe try:

127.0.0.1 localhost.localdomain localhost
192.168.2.105 costarica.fylz.com costarica
192.168.2.102 nicaragua.fylz.com nicaragua

in your /etc/hosts.

That is exactly the content of both /etc/hosts files (with some ipv6 stuff and
a few other machines).

== Server ==
kevin@costarica:~/drbsample$ ruby dchats.rb
druby://costarica.fylz.com:1255
[return] to exit.

== Client ==
kevin@nicaragua:~/ruby/drb$ ruby dchatc.rb druby://costarica.fylz.com:1255
kevin
(druby://costarica.fylz.com:1255) /usr/lib/ruby/1.8/drb/drb.rb:733:in `open':
druby://nicaragua.fylz.com:34220 - #<Errno::ECONNREFUSED: Connection refused
- connect(2)> (DRb::DRbConnError)
from
(druby://costarica.fylz.com:1255) /usr/lib/ruby/1.8/drb/drb.rb:726:in `each'
from
(druby://costarica.fylz.com:1255) /usr/lib/ruby/1.8/drb/drb.rb:726:in `open'
from
(druby://costarica.fylz.com:1255) /usr/lib/ruby/1.8/drb/drb.rb:1185:in
`initialize'
from
(druby://costarica.fylz.com:1255) /usr/lib/ruby/1.8/drb/drb.rb:1165:in `new'
from
(druby://costarica.fylz.com:1255) /usr/lib/ruby/1.8/drb/drb.rb:1165:in `open'
from
(druby://costarica.fylz.com:1255) /usr/lib/ruby/1.8/drb/drb.rb:1082:in
`method_missing'
from
(druby://costarica.fylz.com:1255) /usr/lib/ruby/1.8/drb/drb.rb:1081:in
`with_friend'
from
(druby://costarica.fylz.com:1255) /usr/lib/ruby/1.8/drb/drb.rb:1081:in
`method_missing'
from (druby://costarica.fylz.com:1255) dchats.rb:14:in `initialize'
from (druby://costarica.fylz.com:1255) dchats.rb:37:in `new'
from (druby://costarica.fylz.com:1255) dchats.rb:37:in `add_member'
from dchatc.rb:37


This is why I was whining so heavily a month or so ago. I can connect to the
postgres server on this machine with no problems.... Is there any reason
that DRb needs to use hostnames?

Anyway, now with the /etc/hosts modifications, here's the same 5 commands on
both:

== Server ==
kevin@costarica:~/drbsample$ ruby -rsocket -e 'p Socket.gethostname'
"costarica.fylz.com"

kevin@costarica:~/drbsample$ ruby -rsocket -e 'p
Socket.gethostbyname("costarica.fylz.com")'
["costarica.fylz.com", ["costarica"], 2, "\300\250\002i"]

kevin@costarica:~/drbsample$ ruby -rsocket -e 'p
Socket.gethostbyaddr("\300\250\002i")'
["costarica.fylz.com", ["costarica"], 2, "\300\250\002i"]

kevin@costarica:~/drbsample$ ruby -rsocket -e 'p
Socket.gethostbyname("nicaragua.fylz.com")'
["nicaragua.fylz.com", ["nicaragua"], 2, "\300\250\002f"]

kevin@costarica:~/drbsample$ ruby -rsocket -e 'p
Socket.gethostbyaddr("\300\250\002f")'
["nicaragua.fylz.com", ["nicaragua"], 2, "\300\250\002f"]

== Client ==
kevin@nicaragua:~/ruby/drb$ ruby -rsocket -e 'p Socket.gethostname'
"nicaragua"

kevin@nicaragua:~/ruby/drb$ cat /etc/hosts
127.0.0.1 localhost.localdomain localhost

# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

192.168.2.105 costarica.fylz.com costarica
192.168.2.102 nicaragua.fylz.com nicaragua

kevin@nicaragua:~/ruby/drb$ hostname
nicaragua
kevin@nicaragua:~/ruby/drb$ sudo hostname nicaragua.fylz.com
Password:
kevin@nicaragua:~/ruby/drb$ hostname
nicaragua.fylz.com
kevin@nicaragua:~/ruby/drb$ ruby -rsocket -e 'p Socket.gethostname'
"nicaragua.fylz.com"

So.....what the heck here....?

kevin@nicaragua:~/ruby/drb$ ruby -rsocket -e 'p
Socket.gethostbyname("nicaragua.fylz.com")'
["nicaragua.fylz.com", ["nicaragua"], 2, "\300\250\002f"]

kevin@nicaragua:~/ruby/drb$ ruby -rsocket -e 'p
Socket.gethostbyaddr("\300\250\002f")'
["nicaragua.fylz.com", ["nicaragua"], 2, "\300\250\002f"]

kevin@nicaragua:~/ruby/drb$ ruby -rsocket -e 'p
Socket.gethostbyname("costarica.fylz.com")'
["costarica.fylz.com", ["costarica"], 2, "\300\250\002i"]

kevin@nicaragua:~/ruby/drb$ ruby -rsocket -e 'p
Socket.gethostbyaddr("\300\250\002i")'
["costarica.fylz.com", ["costarica"], 2, "\300\250\002i"]

But still...
kevin@costarica:~/drbsample$ ruby dchats.rb
druby://costarica.fylz.com:1257
[return] to exit.

(By the way, while that's running)
kevin@costarica:~$ netstat -l
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 *:8000 *:* LISTEN
tcp 0 0 *:1257 *:* LISTEN

And I obviously talk:
kevin@nicaragua:~$ telnet costarica.fylz.com 1257
Trying 192.168.2.105...
Connected to costarica.fylz.com.
Escape character is '^]'.
asdf
o:DRb::DRbConnError:bt["//usr/lib/ruby/1.8/drb/drb.rb:570:in
`load'"7/usr/lib/ruby/1.8/drb/drb.rb:609:in
`recv_request'"7/usr/lib/ruby/1.8/drb/drb.rb:908:in
`recv_request'"</usr/lib/ruby/1.8/drb/drb.rb:1527:in
`init_with_client'"9/usr/lib/ruby/1.8/drb/drb.rb:1539:in
`setup_message'"3/usr/lib/ruby/1.8/drb/drb.rb:1491:in
`perform'"5/usr/lib/ruby/1.8/drb/drb.rb:1586:in
`main_loop'"0/usr/lib/ruby/1.8/drb/drb.rb:1582:in
`loop'"5/usr/lib/ruby/1.8/drb/drb.rb:1582:in
`main_loop'"1/usr/lib/ruby/1.8/drb/drb.rb:1578:in
`start'"5/usr/lib/ruby/1.8/drb/drb.rb:1578:in
`main_loop'"//usr/lib/ruby/1.8/drb/drb.rb:1426:in
`run'"1/usr/lib/ruby/1.8/drb/drb.rb:1423:in
`start'"//usr/lib/ruby/1.8/drb/drb.rb:1423:in
`run'"6/usr/lib/ruby/1.8/drb/drb.rb:1343:in
`initialize'"//usr/lib/ruby/1.8/drb/drb.rb:1624:in
`new'"9/usr/lib/ruby/1.8/drb/drb.rb:1624:in `start_service'"dchats.rb:67:
mesg" too large packet 1634952294Connection closed by foreign host.

But:
kevin@nicaragua:~/ruby/drb$ ruby dchatc.rb druby://costarica.fylz.com:1257
kevin
(druby://costarica.fylz.com:1257) /usr/lib/ruby/1.8/drb/drb.rb:733:in `open':
druby://nicaragua.fylz.com:34246 - #<Errno::ECONNREFUSED: Connection refused
- connect(2)> (DRb::DRbConnError)
from
(druby://costarica.fylz.com:1257) /usr/lib/ruby/1.8/drb/drb.rb:726:in `each'
from
(druby://costarica.fylz.com:1257) /usr/lib/ruby/1.8/drb/drb.rb:726:in `open'
from
(druby://costarica.fylz.com:1257) /usr/lib/ruby/1.8/drb/drb.rb:1185:in
`initialize'
from
(druby://costarica.fylz.com:1257) /usr/lib/ruby/1.8/drb/drb.rb:1165:in `new'
from
(druby://costarica.fylz.com:1257) /usr/lib/ruby/1.8/drb/drb.rb:1165:in `open'
from
(druby://costarica.fylz.com:1257) /usr/lib/ruby/1.8/drb/drb.rb:1082:in
`method_missing'
from
(druby://costarica.fylz.com:1257) /usr/lib/ruby/1.8/drb/drb.rb:1081:in
`with_friend'
from
(druby://costarica.fylz.com:1257) /usr/lib/ruby/1.8/drb/drb.rb:1081:in
`method_missing'
from (druby://costarica.fylz.com:1257) dchats.rb:14:in `initialize'
from (druby://costarica.fylz.com:1257) dchats.rb:37:in `new'
from (druby://costarica.fylz.com:1257) dchats.rb:37:in `add_member'
from dchatc.rb:37

I'm at a loss.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,967
Messages
2,570,148
Members
46,694
Latest member
LetaCadwal

Latest Threads

Top