kaa rpc and IPV6
A Mennucc <[email protected]> Tue, 01 Nov 2011 11:06:51 +0100
| Newsgroups | gmane.comp.video.freevo.devel |
|---|---|
| Message-ID | <[email protected]> |
dear all, I have been trying to get freevo 1.9.2b2 up and running for some days ; I uploaded a version in Debian that is reasonably fine (though there are some bugs... I'll post them later on); but I had one major showstopper that I wanted to share. The showstopper was this: when I tried to install freevo 1.9.2b2 (and newer kaa from SVN) in my usual freevo-PC , freevo could not talk to its recordserver. This was quite weird, since it all worked fine in my notebook (!!) After many (many!) hours of trial-and-error, I wrote the two scripts in attachment. The scripts expose a problem , that AFAICT may be (according to tracebacks) in _resolve_hostname_with_action in "kaa/base/sockets.py" Problem: it seems that SVN kaa rpc , binds to IPV6 but ignores IPV4 Note that it makes a difference if in your /etc/hosts.file you have ::1 ip6-localhost ip6-loopback or ::1 localhost ip6-localhost ip6-loopback I will call the first situation [L4] and the second [L6] FYI [L6] is the situation in the notebook ; [L4] in the freevo-PC ----------------------------------- In [L4], when you start the server without hostname # python kaa_rpc_server_test.py & then this server cannot be reached using default argument, # python kaa_rpc_client_test.py Contacting the server on localhost CONNECTING Traceback (most recent call last): File "kaa_rpc_client_test.py", line 12, in <module> kaa.inprogress(channel).wait() File "/usr/lib/pymodules/python2.6/kaa/base/async.py", line 720, in wait return self.result File "/usr/lib/pymodules/python2.6/kaa/base/async.py", line 353, in result raise self._exception[1] kaa.base.async.AsyncException: Exception raised asynchronously; traceback follows: File "/usr/lib/pymodules/python2.6/kaa/base/thread.py", line 181, in __call__ result = self._callable() File "/usr/lib/pymodules/python2.6/kaa/base/callable.py", line 226, in __call__ return cb(*cb_args, **cb_kwargs) File "/usr/lib/pymodules/python2.6/kaa/base/sockets.py", line 527, in _connect self._resolve_hostname_with_action(addr, sock.connect, ipv6) File "/usr/lib/pymodules/python2.6/kaa/base/sockets.py", line 436, in _resolve_hostname_with_action func(addrinfo) File "<string>", line 1, in connect error: [Errno 101] Network is unreachable but it can be reached using python kaa_rpc_client_test.py ip6-localhost ------------------------------------------------------- In [L6], when you start the server without hostname # python kaa_rpc_server_test.py & then this server can be reached, # python kaa_r$ python2.6 kaa_rpc_client_test.py Contacting the server on localhost CONNECTING CONNECTED ciao ----------- both in [L4] and [L6], moreover, netstat does not find the server as a IPV4 , only as IPV6 $ netstat --inet6 -a | grep 19999 tcp6 0 0 [::]:19999 [::]:* LISTEN $ netstat --inet -a | grep 19999 [NO OUTPUT] --------- in [L4], trying to force the hostname to be '127.0.0.1' has this effect # python kaa_rpc_server_test.py 127.0.0.1 & Starting a server that listens on 127.0.0.1 Traceback (most recent call last): File "kaa_rpc_server_test.py", line 15, in <module> rpc = kaa.rpc.Server((host,19999),'secret') File "/usr/lib/pymodules/python2.6/kaa/base/rpc.py", line 169, in __init__ self._socket.listen(address) File "/usr/lib/pymodules/python2.6/kaa/base/sockets.py", line 511, in listen self._resolve_hostname_with_action(addr, sock.bind, ipv6) File "/usr/lib/pymodules/python2.6/kaa/base/sockets.py", line 436, in _resolve_hostname_with_action func(addrinfo) File "<string>", line 1, in bind socket.error: [Errno 22] Invalid argument --------------------- in [L6] it works but AFAICT the netstat is weird $ netstat --inet -an | grep 19999 $ netstat --inet6 -an | grep 19999 tcp6 0 0 127.0.0.1:19999 :::* LISTEN ----------------- also since my local network is IPV4 only, I cannot contact the rpc_kaa_server on one machine using another machine a. ------------------------------------------------------------------------------ RSA® Conference 2012 Save $700 by Nov 18 Register now http://p.sf.net/sfu/rsa-sfdev2dev1 _______________________________________________ Freevo-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/freevo-devel
kaa_rpc_client_test.py
(text/x-python, 403 B)
import sys
import kaa
import kaa.rpc
host='localhost'
if len(sys.argv)>1:
host=sys.argv[1]
print 'Contacting the server on ', host
channel = kaa.rpc.connect((host,19999),'secret', retry=1)
print channel.status
kaa.inprogress(channel).wait()
print channel.status
if channel.status != kaa.rpc.CONNECTED:
print 'ARGH'
else:
inprogress = channel.rpc('ping')
inprogress.wait()
print inprogress.result
kaa_rpc_server_test.py
(text/x-python, 364 B)
import sys
import kaa
import kaa.rpc
host=''
if len(sys.argv)>1:
host=sys.argv[1]
print 'Starting a server that listens on ', (host or 'every inbound call')
class R:
@kaa.rpc.expose('ping')
def ping(self):
return 'ciao'
rpc = kaa.rpc.Server((host,19999),'secret')
r=R()
rpc.register(r)
print('kaa.main starting')
kaa.main.run()
print('kaa.main finished')
signature.asc
(application/pgp-signature, 262 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk6vxL4ACgkQ9B/tjjP8QKQ3rQCfZpdrhWm0b4bybNb11cdJVqBb rQkAmgJ7SifNCuWtr4IvPhYjDwFrJBI/ =lXC+ -----END PGP SIGNATURE-----