[Twisted-Python] Leaking memory with twisted-web

Alex Levy mesozoic at polynode.com
Wed Oct 8 04:25:32 EDT 2003

I am using distrib.ResourceSubscription and ResourcePublisher to link a
user-run web server with Moshe's twisted-web. I've noticed something
very odd going on; my twistd process will progressively hog memory and
CPU time to the point that the entire server slows down. Here is a
snippet of what's happening:

2003/10/03 19:00 EDT [HTTPChannel,14,] Starting factory
<twisted.spread.pb.PBClientFactory instance at 0x84bafbc>
2003/10/03 19:00 EDT [Broker,client] connected to publisher

And then, days later...

2003/10/08 04:12 EDT [Broker,client] Stopping factory
<twisted.spread.pb.PBClientFactory instance at 0x84bafbc>
2003/10/08 04:12 EDT [Broker,client] could not connect to distributed
web service: connection dropped

I imagine this means that all the PBClientFactory instances are sitting
around, doing nothing, and clogging my meager 64MB of RAM. Here is the
code I'm using to do this:

--- snip /www/mesozoic.geecs.org/siteroot.rpy ---
subscription = ResourceSubscription('unix', '/home/mesozoic/.pb-web')
resource.putChild('cogito', subscription)
--- snip ---

--- snip /home/mesozoic/pb-web.tpy ---
file = static.File('./pb-web')
site = server.Site(file)
--- snip ---

Could all these PBClientFactory instances be popping up because my
ResourceSubscription is in an .rpy instead of in the twisted-web config
files? Or is this an internal bug that shouldn't be happening? Or do I
need to share more information?

I can't deal with having to restart twisted-web every few days... help?

Alex Levy
WWW: http://mesozoic.geecs.org

"Never let your sense of morals prevent you from doing what is right."
-- Salvor Hardin, Isaac Asimov's _Foundation_

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://twistedmatrix.com/pipermail/twisted-python/attachments/20031008/d715b78e/attachment.pgp 

More information about the Twisted-Python mailing list