report: bzr selftest hangs on win32

Andrew Bennetts andrew at canonical.com
Thu Sep 21 04:41:17 BST 2006


On Thu, Sep 21, 2006 at 01:20:00PM +1000, Andrew Bennetts wrote:
> On Wed, Sep 20, 2006 at 12:23:20PM +0300, Alexander Belchenko wrote:
[...]
> >   File "D:\Bazaar\sandbox\bzr.dev\bzrlib\transport\smart.py", line 172,
> > in _recv_tuple
> >     req_line = from_file.readline()
> >   File "E:\Python24\lib\socket.py", line 340, in readline
> >     data = self._sock.recv(self._rbufsize)
> > error: (10035, 'The socket operation could not complete without blocking')
> 
> This is odd.  It may be the cause of some of the test failures, but I'm not sure
> why that socket would be non-blocking... oh, it's probably because of this line in
> SmartTCPServer.__init__:
> 
>         self._server_socket.settimeout(1)
> 
> socket.settimeout works internally by making the socket non-blocking.
> 
> Alexander, could you try commenting out that line and see if it helps?

It might be that on windows accepted sockets inherit non-blockingness from the
listening socket?  That doesn't seem to happen on linux.  That would explain
this problem.

If so, this patch might help:

=== modified file 'bzrlib/transport/smart.py'
--- bzrlib/transport/smart.py   2006-09-18 09:58:40 +0000
+++ bzrlib/transport/smart.py   2006-09-21 03:35:32 +0000
@@ -519,6 +519,7 @@
     def accept_and_serve(self):
         conn, client_addr = self._server_socket.accept()
         conn.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
+        conn.setblocking(False)
         from_client = conn.makefile('r')
         to_client = conn.makefile('w')
         handler = SmartStreamServer(from_client, to_client,

-Andrew.





More information about the bazaar mailing list