earl.chew added the comment:

In the original code, the key to the failure I observed is:

        # wait for port to be assigned
        n = 1000
        while n > 0 and PORT is None:
            time.sleep(0.001)
            n -= 1

This gives a fixed deadline for the server thread to create the DocXMLRPCServer 
instance and provide the corresponding TCP port on which it is listening.

If the server thread is late (or if an exception is thrown -- but this case 
might work out ok), the TCP port will not be available in the variable PORT. In 
this case, the client thread blunders on, and inadvertently fails because PORT 
== None.

Upon failure, the test case tries to complete by tearing down the test:

     def tearDown(self):
         self.client.close()
 
         self.evt.wait()

The test case waits for self.evt to indicate that the server has completed. 
However, the server thread is running this:

        while numrequests > 0:
            serv.handle_request()
            numrequests -= 1

In other words, the test is deadlocked because the server is waiting to process 
requests (actually it's waiting for a single request) from the client, but the 
client has already given up and is waiting for the server thread to complete.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue27614>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to