I have a problem with xmlrpc request inside a thread.
The thread containing the xmlrpc request can be killed at any moment then restart.
What happen is that last xmlrpc request was not completed when thread was killed and restarted, then a new xmlrpc request occured. It seems that the new request parameter is append to the uncompleted request and the server receive a request with 2 parameters and an error occure.
It occure with our C++ xmlrpc server and I reproduce that with a simple python server.
Here the code to reproduce easily the error:
def bug_thread_xmlrpc():
linalg = rpc_factory("xmlrpc","http://10.20.7.222:8080")
thread do_xmlrpc_request():
while True:
stdDeviationFx = linalg.std([1,2,3,4,5,6,7,8,9,10])
end
end
while True:
th = run do_xmlrpc_request()
sleep(0.5)
kill th
end
end
And the python xmlrpc server :
#! /usr/bin/python
from SimpleXMLRPCServer import SimpleXMLRPCServer
def stdDeviation(val):
print val
server = SimpleXMLRPCServer(("", 8080), allow_none=True)
print "Listening on port 8080..."
server.register_function(stdDeviation, "std")
server.serve_forever()
This is a minimal exemple to reproduce the problem but I can’t prevent this situation to happen.
Do you have any suggestions ?
I already try to create the rpc factory inside thread and to put enter_critical and exit_critical arround the xmlrpc call but nothing change.
thanks