#2913: Memory Leak on SVN Repo Access using tracd or WSGI
---------------------------------------+------------------------------------
Reporter: edsuom | Owner: jonas
Type: defect | Status: new
Priority: high | Milestone: 0.10
Component: browser | Version: devel
Severity: major | Resolution:
Keywords: wsgi, tracd, memory, leak |
---------------------------------------+------------------------------------
Comment (by mgood):
No, I can't actually reproduce this either on Ubuntu Dapper w/ SVN 1.3.0
and SWIG 1.3.27. I also added a debugging test to track the active `Pool`
objects, and it always drops to 1 after each request (1 instance is always
kept as the `application_pool`):
{{{
#!diff
Index: trac/versioncontrol/svn_fs.py
===================================================================
--- trac/versioncontrol/svn_fs.py (revision 9059)
+++ trac/versioncontrol/svn_fs.py (local)
@@ -90,6 +90,8 @@
class Pool(object):
"""A Pythonic memory pool object"""
+ _pools = set()
+
# Protect svn.core methods from GC
apr_pool_destroy = staticmethod(core.apr_pool_destroy)
apr_terminate = staticmethod(core.apr_terminate)
@@ -143,12 +145,19 @@
# Destroy pool
self.apr_pool_destroy(self._pool)
+ import gc
+ from sys import stderr
+ gc.set_debug(gc.DEBUG_UNCOLLECTABLE)
+ print >>stderr, 'GarbageCollect:', gc.collect()
+ print >>stderr, 'Garbage:', len(gc.garbage)
+
# Clear application pool and terminate APR if necessary
if not self._parent_pool:
application_pool = None
self.apr_terminate()
self._mark_invalid()
+ print >>stderr, 'Pools:', len(Pool._pools)
def __del__(self):
"""Automatically destroy memory pools, if necessary"""
@@ -170,6 +179,7 @@
# mark pool as valid
self._is_valid = lambda: 1
+ Pool._pools.add(id(self))
def _mark_invalid(self):
"""Mark pool as invalid"""
@@ -181,6 +191,7 @@
del self._parent_pool
if hasattr(self, "_weakref"):
del self._weakref
+ Pool._pools.remove(id(self))
# Initialize application-level pool
}}}
--
Ticket URL: <http://projects.edgewall.com/trac/ticket/2913>
The Trac Project <http://trac.edgewall.com/>
_______________________________________________
Trac-Tickets mailing list
[email protected]
http://lists.edgewall.com/mailman/listinfo/trac-tickets