This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author earl.chew
Recipients earl.chew, martin.panter, r.david.murray, serhiy.storchaka
Date 2016-08-05.15:16:48
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1470410209.21.0.824846956877.issue27614@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2016-08-05 15:16:49earl.chewsetrecipients: + earl.chew, r.david.murray, martin.panter, serhiy.storchaka
2016-08-05 15:16:49earl.chewsetmessageid: <1470410209.21.0.824846956877.issue27614@psf.upfronthosting.co.za>
2016-08-05 15:16:49earl.chewlinkissue27614 messages
2016-08-05 15:16:48earl.chewcreate