the xmlrpclib.ServerProxy is not thread safe, no. Nor is it designed to
be. the documentation never claims that it is and the fact that the old
version was (due to a new HTTPConnection being created each time) is a
coincidence than a design feature.
In my own client code I use a pool of ServerProxy objects for each
thread to claim and use one at a time. This way I can have many
simultaneous requests to the same server going.
You can also create your own lock and share a ServerProxy among threads.
Also note that HTTPConnection is not thread safe either. And in
general, class instances in the lib are not thread safe unless
explicitly documented to be so. |