On Feb 16, 2006, at 8:36 AM, Brad Anderson wrote:

Yes I have the exact same problem, and I'm actively tracking it. I've spoken with cmlenz and jborg in #trac on IRC and I'm trying some things.

I thought it was that db.close() isn't being called, so the connections aren't returned to the pool. But the connections should be garbage-collected at the end of the request. I've also done some work with the 'gc' module, tracking what is collectable or not by the garbage collector. The thought here is that something is keeping a reference to the connection and it can't be collected at the end of the request when everything is done. I'm still not sure yet, but I'll keep you posted on my progress.

Is there a ticket number?

I have a system with 14 projects set up, each with it's own database and username. So within a few days every httpd process will be holding a db connection for every trac project it's served out. Restarting apache seems to close all the database connections, so that's an easy fix.

Found some interesting info here: http://www.modpython.org/pipermail/ mod_python/2003-September/014154.html

Doesn't explain where the caching might be happening, but still interesting reading.

Here's some more strange things. After restarting apache, there's no database connections. Visiting one trac project created five new postgres connections:

# ps -ef | grep postgres
postgres 11751 10767 0 10:05 ? 00:00:00 postgres: webAuth webAuth [local] idle postgres 11752 10767 0 10:05 ? 00:00:00 postgres: webAuth webAuth [local] idle postgres 11753 10767 0 10:05 ? 00:00:00 postgres: webAuth webAuth [local] idle postgres 11754 10767 0 10:05 ? 00:00:00 postgres: webAuth webAuth [local] idle postgres 11755 10767 0 10:05 ? 00:00:00 postgres: webAuth webAuth [local] idle

template1=# select * from pg_stat_activity;
 35167 | webAuth   |   11755 |      111 | webAuth |               |
35167 | webAuth   |   11754 |      111 | webAuth |               |
35167 | webAuth   |   11753 |      111 | webAuth |               |
35167 | webAuth   |   11752 |      111 | webAuth |               |
35167 | webAuth   |   11751 |      111 | webAuth |               |

I can't think why that would happen except for keepalive. I checked httpd.conf to see if KeepAlive was turned on and it wasn't. I turned it on, and one visit to the trac project still produced 4 postgres connections.

Steve
_______________________________________________
Trac mailing list
[email protected]
http://lists.edgewall.com/mailman/listinfo/trac

Reply via email to