[ZCM] [ZC] 1632/ 1 Request "ZEO: infinite loop during connection"
Collector: Zope Bugs, Features,
and Patches ...
zope-coders-admin at zope.org
Mon Dec 20 08:56:51 EST 2004
Issue #1632 Update (Request) "ZEO: infinite loop during connection"
Status Accepted, Database/bug medium
To followup, visit:
http://collector.zope.org/Zope/1632
==============================================================
= Request - Entry #1 by efge on Dec 20, 2004 8:56 am
Status: Pending => Accepted
Supporters added: tim_one
Reported by Dieter Maurer:
(http://mail.zope.org/pipermail/zodb-dev/2004-December/008262.html)
In our ZODB 3.2 version, we occasionally (about 1 in 1000)
observe an infinite loop in the ZEO client during connection
with the ZEO server.
The infinite loop happens in "ZEO.ServerStub.ServerStub.__init__"
in the loop:
# Wait until we know what version the other side is using.
while rpc.peer_protocol_version is None:
rpc.pending()
In our case, the connection ("rpc") is in synchronous mode
such that "rpc.pending()" checks whether there is something to
read (and reads it in this case).
Apparently, the message with the server protocol version
is somehow lost. I do not understand how this may happen.
Nevertheless, the code (as it is now) is a bit stupid.
I cannot see a reason why "rpc.pending()" is not called with
a non-zero timeout value (this would allow for passive waiting
rather than busy waiting).
Calling "pending" with a timeout reduces the effects of the infinite loop
(creating a significant continuous load on the host) only for
synchronous mode. Therefore, I also added an explicit timeout.
Surpassing this timeout results in an exception.
My code now looks like:
# Wait until we know what version the other side is using.
st = time()
while rpc.peer_protocol_version is None:
if time() - st > ZEO_MAX_RESPONSE_TIME:
# the server took too long to report its version
rpc.close()
raise EnvironmentError("ZEO server's initial response exceeded %ss" % ZEO_MAX_RESPONSE_TIME)
rpc.pending(30)
if rpc.peer_protocol_version == 'Z200':
==============================================================
More information about the Zope-Collector-Monitor
mailing list