ZEO: infinite loop during connection

Bug #143267 reported by Florent Guillaume
4
Affects Status Importance Assigned to Milestone
ZODB
Won't Fix
Medium
Unassigned

Bug Description

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':

Tags: bug database
Revision history for this message
Tim Peters (tim-one) wrote :

Unassigned myself -- I haven't done ZODB work in nearly 3 years :-(

Changed in zope2:
assignee: tim-one → nobody
affects: zope2 → zodb
Revision history for this message
Jim Fulton (jim-zope) wrote :

Sorry, this is just too old.

The relevant code has changed quite a bit since then.

If you still care and are still having the problem, please create
a new issue.

Changed in zodb:
status: Confirmed → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.