[Zope] Zope 2.8.4 strange behavior
Dieter Maurer
dieter at handshake.de
Tue Nov 29 14:39:32 EST 2005
Paul Winkler wrote at 2005-11-28 15:37 -0500:
> ...
>> We had to implement a keep alive mechanism to prevent our firewall
>> from behaving in this nasty way.
>
>OK. Can you give a high-level summary of what you did? I thought of
>using heartbeat to detect loss of connection, but I'm not sure what I
>could do on failure short of restarting Zope.
We knew that our firewall shuts down connections with a timeout
of 30 min. Thus, we have send our ZEO a keep alive message
every 20 min. The code roughly looks like this:
KeepPeriod= int(environ.get('ZEO_KEEP_ALIVE')) * 60
Storage = getConfiguration().dbtab.getDatabase('/')._storage
def keepAlive():
LOG("CustomZODB",INFO,"Keep alive thread started")
while 1:
sleep(KeepPeriod)
if Storage._ready.isSet():
LOG("CustomZODB",INFO,"Sending keep alive message")
Storage._load_lock.acquire()
try:
try:
Storage._server.get_info()
LOG("CustomZODB",INFO,"Sent keep alive message")
except:
LOG("CustomZODB",ERROR,".... failed", error=exc_info())
finally: Storage._load_lock.release()
else:
LOG("CustomZODB",PROBLEM,"Connection is down")
start_new_thread(keepAlive,())
--
Dieter
More information about the Zope
mailing list