ZEO: infinite loop during connection
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
ZODB |
Won't Fix
|
Medium
|
Unassigned |
Bug Description
Reported by Dieter Maurer:
(http://
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
in the loop:
# Wait until we know what version the other side is using.
while rpc.peer_
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_
if time() - st > ZEO_MAX_
# the server took too long to report its version
if rpc.peer_
affects: | zope2 → zodb |
Unassigned myself -- I haven't done ZODB work in nearly 3 years :-(