-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Jonas Borgström wrote:
> Russ Brown wrote:
>> Not long back I switched from the prefork apache MPM to the worker one,
>> at the suggestion of coderanger (due to better memory efficiency etc). I
>> set it up to run on two processes each spawning a number of threads.
>>
>> Yesterday we encountered Trac being unable to connect to the database
>> (Postgres 8.2, Trac 0.11 RC2), and when investigating it noticed that
>> trac only had two connections open (two large requests were being
>> processed at this time leading to the site being unavailable to other
>> requests).
> 
> Did you get a "Unable to get database connection within 20 
> seconds"-error or something else?
> 

Yes, it was exactly that error. It wasn't me personally who encountered
it, but that was the message that was passed on to me.

> The exact traceback would also be interesting.
> 

2008-06-25 13:00:41,179 Trac[main] ERROR: Unable to get database
connection within 20 seconds
Traceback (most recent call last):
  File "/usr/lib/python2.4/site-packages/trac/web/main.py", line 423, in
_dispatch_request
    dispatcher.dispatch(req)
  File "/usr/lib/python2.4/site-packages/trac/web/main.py", line 164, in
dispatch
    if handler.match_request(req):
  File "build/bdist.linux-i686/egg/tractags/web_ui.py", line 66, in
match_request
  File "/usr/lib/python2.4/site-packages/trac/web/api.py", line 168, in
__getattr__
    value = self.callbacks[name](self)
  File "/usr/lib/python2.4/site-packages/trac/web/main.py", line 254, in
_get_perm
    return PermissionCache(self.env, self.authenticate(req))
  File "/usr/lib/python2.4/site-packages/trac/web/main.py", line 131, in
authenticate
    authname = authenticator.authenticate(req)
  File "build/bdist.linux-i686/egg/acct_mgr/web_ui.py", line 402, in wrap
  File "build/bdist.linux-i686/egg/acct_mgr/web_ui.py", line 413, in
authenticate
  File "/usr/lib/python2.4/site-packages/trac/web/auth.py", line 71, in
authenticate
    authname = self._get_name_for_cookie(req, req.incookie['trac_auth'])
  File "/usr/lib/python2.4/site-packages/trac/web/auth.py", line 181, in
_get_name_for_cookie
    db = self.env.get_db_cnx()
  File "/usr/lib/python2.4/site-packages/trac/env.py", line 257, in
get_db_cnx
    return DatabaseManager(self).get_connection()
  File "/usr/lib/python2.4/site-packages/trac/db/api.py", line 76, in
get_connection
    return self._cnx_pool.get_cnx(self.timeout or None)
  File "/usr/lib/python2.4/site-packages/trac/db/pool.py", line 107, in
get_cnx
    raise TimeoutError('Unable to get database '
TimeoutError: Unable to get database connection within 20 seconds


>> I asked about this in IRC and was told that there were issues with the
>> pooling in RC2 and that I should upgrade to 0.11. coderanger also
>> mentioned the TRAC_DB_POOL_SIZE environment variable which could be used
>> to control the connection pooling.
> 
> The connection currently in 0.11 is limited to 5 connections per 
> environment per apache process. So as far as I can tell you should be 
> able to get up to 10 concurrent requests with your setup, and certainly 
> more than 2.
> 

At the time we were running 0.11RC2. I'm just looking at
pg_stat_activity now and we are actually showing three connections, so
perhaps the pooling code is working better in 0.11 final (and only
creating more than one per processes if it actually needs it).

>> I did that, but Trac still only held two connections open. I viewed
>> trac/db/pool.py and saw no mention of TRAC_DB_POOL_SIZE. Looking at the
>> file on trunk (of t.e.o) I do see it there, which suggests that
>> TRAC_DB_POOL_SIZE was actually added post 0.11. I also don't see it in
>> that file on the 0.11-stable branch.
>>
>> Is there any estimate as to when this change might be released (e.g.
>> 0.11.1)?
> 
> Yes, it's planned for 0.11.1. If you want to test it now all you need to 
> do is to download and replace pool.py from trunk:
> 
> http://svn.edgewall.org/repos/trac/branches/0.11-stable/trac/db/pool.py
> 

I'll monitor the connection count further and will install this if it
seems like it is needed.

Thanks!

> / Jonas
> 
> > 


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFIaNP5hXYlbEtYt2wRArQWAKCYPDpcoEl5BU7FCdzr1yjZhqd81ACdHqNs
splSqXk4cDWTIDJ/5mqnSyY=
=YLAE
-----END PGP SIGNATURE-----

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Trac 
Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/trac-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to