Using RTAI-XML with Python hangs Python execution

Arno Stienen a.h.a.stienen at utwente.nl
Sat May 26 15:56:43 EDT 2007


Hello all,

It has been a while, but I finally found the time to further investigate 
my problems with connecting Python to a RTAI-XML server. As I cannot 
tell if the problems I'm facing are caused by RTAI-XML (or more 
precisely, the xmlrpc++0.7 library) or Python (xmlrpclib), I'm posting 
this message on both the RTAI as the Python mailing list.

Just to recap, here are the symptoms I described earlier.

I am using two computers. One is running the RTAI-patched real-time 
linux kernel, and this computer controls my robotic hardware. On this 
RTAI computer I installed the RTAI-XML server, which uses incoming 
XML-RPC calls to control real-time processes on the server. RTAI-XML is 
programmed in C++, using the xmlrpc++0.7 library.

The second is a desktop machine (Windows XP or Ubuntu), from which a 
XML-RPC connection can be made to the RTAI computer. Although in theory 
it should make no difference if I use C, C++, Java or Python to make the 
connection, in practise I can get the Java connection running, but have 
problems using Python. And I really like to use Python to quickly create 
interfaces!

When connecting with Python on the desktop computer to the RTAI-XML 
server running on my RTAI machine, I used the following code.

         import xmlrpclib
         server = xmlrpclib.Server("http://10.10.101.62:29500")
	print server.Info_RT('Master')

This results in the correct output:

	{'state': 0, 'str': 'Info_RT'}

Yet, this is only an information call. The really interesting part 
should comes when I ask the server to open a connection:

         import xmlrpclib
         server = xmlrpclib.Server("http://10.10.101.62:29500")
         print server.Connection_Request("roberto")

But then nothing happens. Python just hangs and is unresponsive. Until, 
I kill the RTAI-XML server on the RTAI computer! And then suddenly the 
correct output appears on the desktop command line:

         {'state': 0, 'id_session': '2Z3EUSLJFA13', 'port': 29501,
         'str': 'Connection accepted. Session attached.'}

(Using an alternative Python XML-RPC library '#import pyxmlrpclib as 
xmlrpclib' makes no difference to the result.)

So what happens? I did some experiments. I did some package sniffing 
with Wireshark and I did Python tracing. I stored the sniffing results 
in both the Wireshark as plain text format. The files for the first 
Info_RT examples are here:

http://ctw-bw008.ctw.utwente.nl/~arno/rtaixml/roberto-infort-python.ws
http://ctw-bw008.ctw.utwente.nl/~arno/rtaixml/roberto-infort-python-ws.txt
http://ctw-bw008.ctw.utwente.nl/~arno/rtaixml/roberto-infort-trace.txt

The files for the second, not correctly working example are here:

http://ctw-bw008.ctw.utwente.nl/~arno/rtaixml/roberto-conreq-python.ws
http://ctw-bw008.ctw.utwente.nl/~arno/rtaixml/roberto-conreq-python-ws.txt
http://ctw-bw008.ctw.utwente.nl/~arno/rtaixml/roberto-conreq-trace.txt
http://ctw-bw008.ctw.utwente.nl/~arno/rtaixml/roberto-conreq-trace-hardbreak.txt

The first three files all include killing the server after ~30 seconds, 
thus resulting in the correct output. In the fourth files, tracing is 
stopped before the server is killed. It is therefor the trace up to the 
'hanging point'.

Any, really any, suggestions are appreciated!

Kind regards,
Arno Stienen.



More information about the Python-list mailing list