[ZODB-Dev] ZEO client hangs when combined with other asyncore code

Tim Peters tim at zope.com
Tue Jun 21 14:56:19 EDT 2005


[zodb at bootsch.demon.nl]
>> We have an application that makes use of a ZEO client and has other
>> async socket code that implements as POP3 proxy. The ZEO client is
>> called (to query and store ZEO server) from within the proxy code when
>> it runs during mail checks, so we have multiple async connections at the
>> same time.
>>
>> Somehow, a call to the ZEO client never returns, it just hangs and sits
>> there.

[Dieter Maurer]
> As long as you ensure that the "asyncore" mainloop is running, there
> should not be a problem to have more "asyncore" clients.
>
> If you happen to run your application on Linux (and use the "GDB"), I
> can provide detailed instructions on how to find out where your code
> hangs...

That would be helpful!

asyncore gives me a headache.  I wonder whether this could be the problem:
Paul said he's calling ZEO "from within the proxy code", but it sounds like
the proxy code itself runs "as a side effect" of asyncore callbacks.  If the
flow is like this:

   asyncore mainloop invokes POP3 proxy code
       POP3 proxy code makes a synchronous ZEO call

then I figure the app may well hang then:  the thread running the asyncore
mainloop is still running a POP3 proxy callback, waiting for a response that
can never happen until the asyncore mainloop gets control back (in order to
send & receive ZEO messages).

IOW, if Paul added print statements to ZODB's ZEO/zrpc/smac.py's
SizedMessageAsyncConnection readable() and writable() methods, I bet they
never trigger when the app appears to be hung (which would mean that the
thread running asyncore's mainloop is in fact not getting a chance to run
the asyncore loop anymore).



More information about the ZODB-Dev mailing list