SVN: ZODB/trunk/src/ZEO/ServerStub.py Time out waiting for protocol handshake. Otherwise, we sometmes see

Jim Fulton <[email protected]>
Newsgroups gmane.comp.python.zope.zodb.cvs
Message-ID <20091011174242.191B494178__35379.4851726436$1255282983$gmane$org@cvs.zope.org>
Log message for revision 105015:
  Time out waiting for protocol handshake.  Otherwise, we sometmes see
  hangs under extreme conditions.
  

Changed:
  U   ZODB/trunk/src/ZEO/ServerStub.py

-=-
Modified: ZODB/trunk/src/ZEO/ServerStub.py
===================================================================
--- ZODB/trunk/src/ZEO/ServerStub.py	2009-10-11 14:41:46 UTC (rev 105014)
+++ ZODB/trunk/src/ZEO/ServerStub.py	2009-10-11 17:42:41 UTC (rev 105015)
@@ -13,6 +13,7 @@
 ##############################################################################
 """RPC stubs for interface exported by StorageServer."""
 
+import os
 import time
 
 ##
@@ -368,11 +369,12 @@
     def iterator_gc(self, iids):
         raise NotImplementedError
 
-
 def stub(client, connection):
-
+    start = time.time()
     # Wait until we know what version the other side is using.
     while connection.peer_protocol_version is None:
+        if time.time()-start > 10:
+            raise ValueError("Timeout waiting for protocol handshake")
         time.sleep(0.1)
 
     if connection.peer_protocol_version < 'Z309':
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.