[Zope] ClientDisconnected - how to prevent this from showing up?

george donnelly list at zettai.net
Mon May 24 20:44:48 EDT 2004


Dieter Maurer <dieter at handshake.de> on 5/24/04 wrote:

>>i see, thanks. the keep ailve messages, are these nat rules, http
>>requests? something else?
>
>The are generated like this:
>
>
>The code is executed during initialization of one product.

thanks for sharing that.  that was really nice of you. It looks like it
solved my problem.

for the benefit of others who run into this problem, i created a
directory ZEONATKeepAlive in instance_home/Products and inside there i
created a file __init__.py and put the below code into it (Dieter's
original unmodified code would have been fine too), and restarted zope.

in my event.log i got this

2004-05-24T16:29:26 INFO(0) CustomZODB Keep alive thread started

then later

2004-05-24T16:39:26 INFO(0) CustomZODB Sending keep alive message
------
2004-05-24T16:39:26 INFO(0) CustomZODB Sent keep alive message

So I suspect i installed it correctly.

for those who might want the script packaged up as a normal zope
product, here it is:

http://files.zettai.net/ZEONATKeepAlive.tar.gz


##__init__.py

###Hard work done by Dieter Maurer, thanks!

__doc__ = 'ZEO Over NAT Keep Alive'

__version__ = '0.1' 

from thread import start_new_thread
from time import sleep
from zLOG import LOG, INFO, PROBLEM, ERROR
from sys import exc_info
from os import environ

from App.config import getConfiguration

KeepPeriod=600

#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._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._lock.release()
        else:
            LOG("CustomZODB",PROBLEM,"Connection is down")
start_new_thread(keepAlive,())


<-->
george donnelly ~ http://www.zettai.net/ ~ "Quality Zope Hosting"
Shared and Dedicated Zope Hosting ~ Zope Servers ~ Zope Websites
Yahoo, AIM: zettainet ~ ICQ: 51907738 ~ Sales (USA): 1-866-967-3669



More information about the Zope mailing list