From: Alan K. <jyt...@xh...> - 2007-07-30 19:02:49
|
[Pekka] >> ... I got another problem when >>trying to run socket tests repeatedly. All tests pass the first time >>but on the second round they hung on "testConnectWithLocalBind >>(__main__.NonBlockingTCPTests)". This happens if I have half a minute >>pause between test runs but if the pause is one minute everything goes >>ok and all tests pass. Pekka, I think this is the same Linux binding problem again. Please can you try this definition of the client method for that test, which should resolve the issue. def _testConnectWithLocalBind(self): # Testing blocking connect with local bind self.cli.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) self.cli.bind( (HOST, PORT-1) ) self.cli.connect((HOST, PORT)) bound_host, bound_port = self.cli.getsockname() self.failUnlessEqual(bound_port, PORT-1) [Raghuram] > The problem is with the usage of hard coded port number 50006. If I > change the code to use a dynamic port number for client-side (in place > of PORT-1), there is no hang. Indeed, while that will make the test pass, I'd prefer not to opt for that solution just yet. If we had taken this option to make the server bind problems on Linux go away, then we'd never have found the bug that Charlie fixed, relating to SO_REUSEADDR on 'accept'ed client sockets. Regards, Alan. |