The issue #6099 (part of #6267 superset) introduced a regression: xmlrpclib.make_connection() is not thread safe. If xmlrpclib is used in two threads, the socket is shared, but it doesn't any lock, and so data will be mixed between the two requets. It becomes worse when I use SSL (pyopenssl or m2crypto). A possible solution is to use a different socket for each thread. Note: I really love #6099, it was exactly what I needed :-)
Author: Kristján Valur Jónsson (kristjan.jonsson) *
Date: 2009-09-14 11:10
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.
@krisvale: You changed the resolution to invalid, but you leaved the state unchanged (open). Ok, I agree that the stdlib is not thread safe, and so I closed this issue. I saw this issue as a regression because the previous version (using a different socket for each XML-RPC request) was thread sae (even if it wasn't designed to be thread safe) :-)