On Sep 19, 2007, at 4:22 AM, Max Ischenko wrote:

What is the correct way to find it out?

PasteScript-1.3.6
Beaker-0.7.5
Pylons-0.9.6
SQLAlchemy-0.3.10-py2.4.egg

There are 2 leaks present in the latest Pylons, both of them in dependent packages Paste and Beaker. The Beaker one can leak rapidly depending on what you're doing, while the Paste leak occurs during 404 and other errors (which could add up fast if you get lots of bots hitting 404 pages).

The Paste error was due to the Registry not properly freeing up all the globals at the end of the request for its context, this has been fixed in the latest svn Paste. If you want a work-around for this leak, moving the RegistryMiddleware in your middleware.py to be right after the PylonsApp will remedy it.

As arash noted, this occurs less under Paste HTTP server than CherryPy, this is because the Paste server is recycling threads after 100 requests so leaks are less harmful, while CherryPy doesn't.

Ths second leak is in Beaker, and due to how its handling the dbm module. Right now, the easiest fix is to either install gdbm, so that its using gdbm when you do:
import anydbm
anydbm._defaultmod

Or, wherever you're using the @beaker_cache decorator, change the type argument to be 'file', or one of the other backends. Until I track down why exactly the dbhash and dummydbm backends appear to leak, the best way to work around it is to use one of the other Beaker backends. Note that @beaker_cache always defaults to using dbm when no type is provided, regardless of the global beaker.cache.type setting in the config, this bug was fixed in the latest Pylons tip.

If changing the Registry middleware, and removing instances of beaker_cache that were using dbm don't fix the leaks, let me know.

Cheers,
Ben

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to