[ZCM] [ZC] 2334/ 3 Comment "_ConnectionPool._reduce_size provides no hook"
"Collector: Zope Bugs, Features, and Patches ..." <[email protected]> Wed, 13 Jun 2007 09:16:18 -0400
| Newsgroups | gmane.comp.web.zope.devel.collector-monitor |
|---|---|
| Message-ID | <[email protected]> |
Issue #2334 Update (Comment) "_ConnectionPool._reduce_size provides no hook" Status Pending, Database/feature medium To followup, visit: http://www.zope.org/Collectors/Zope/2334 ============================================================== = Comment - Entry #3 by tseaver on Jun 13, 2007 9:16 am One possibility would be to set the "target" size of connections which are removed from the pool to 0, and just allow ZODB's garbage collection to do its thing for you. We might also add an event to be published at removal (maybe at add, as well); you could then register a subscriber which used the about-to-be removed ZODB connection to find the DA and issued the 'close'. ________________________________________ = Comment - Entry #2 by eikenberry on Jun 12, 2007 10:37 pm After thinking about this some more I don't think a callback/hook would work here as there are no guarantees that the connection is not still in use at this point. Maybe I could check for this in a synchronizer. Detect that the connection has been removed from the pool and close the database connection. Detecting that the connection has been removed from the pool is the trick though. ________________________________________ = Request - Entry #1 by eikenberry on Jun 12, 2007 6:25 pm Tracked down a local memory leak to Zope leaking database connections when the _ConnectionPool is temporarily expanded beyond the target size. When the pool is resized the mysql connections are leaked. This is a known limitation with mysqldb, that you must explicitally close() a connection or it will leak. But there is no hook provided to do this. Unless I'm missing some way of doing this (always possible) I think providing a hook here would really help when dealing with not quite well behaved C modules. ==============================================================