[Zope-dev] killing zombies

Robin Becker robin@jessikat.demon.co.uk
Fri, 19 Nov 1999 00:40:11 +0000


After putting the site I've developed on a live test basis I notice that
I'm getting some zombie connections. I'm using the medusa active channel
display code as in the code below.

I notice that there are kill_zombies method for zhhtp_channel, but how should
I use that method? My approach uses a similar approach, but is probably wrong.
The zombie killers aren't happening in Zope as it stands. Can I ask why not?
can I get the same thing to happen for other channels eg ftp etc?


#status.py
from ZServer.medusa.status_handler import channel_list_producer
from ZServer.medusa.asyncore import socket_map
from ZServer.HTTPServer import zhttp_channel
from string import replace
from time import time

def __build(s):
        r=''
        while 1:
                t = s.more()
                if t=='': break
                r = r + t
        return r

def get_active_channels():
        r=''
        s=channel_list_producer('aaaa')
        r = r + replace(__build(s),'<p><a href="aaaa">Status Report</a>','')
        return r

def kill_zombies(self):
        now = int (time())
        for channel in socket_map.keys():
                if channel.__class__ == zhttp_channel:
                        if (now - channel.creation_time) > channel.zombie_timeout:
                                channel.close()
-- 
Robin Becker