#9572 closed defect (fixed)
Attribute error reported
| Reported by: | Owned by: | Christian Boos | |
|---|---|---|---|
| Priority: | normal | Milestone: | 0.12.1 |
| Component: | database backend | Version: | 0.12-stable |
| Severity: | normal | Keywords: | |
| Cc: | Branch: | ||
| Release Notes: | |||
| API Changes: | |||
| Internal Changes: | |||
Description
I have just updated our trac to r10006 , sourced from the 0.12-stable branch, and found the following error.
Traceback (most recent call last):
File "build/bdist.linux-i686/egg/trac/web/api.py", line 436, in send_error
data, 'text/html')
File "build/bdist.linux-i686/egg/trac/web/chrome.py", line 803, in render_template
message = req.session.pop('chrome.%s.%d' % (type_, i))
File "build/bdist.linux-i686/egg/trac/web/api.py", line 212, in __getattr__
value = self.callbacks[name](self)
File "build/bdist.linux-i686/egg/trac/web/main.py", line 298, in _get_session
return Session(self.env, req)
File "build/bdist.linux-i686/egg/trac/web/session.py", line 167, in __init__
self.get_session(req.authname, authenticated=True)
File "build/bdist.linux-i686/egg/trac/web/session.py", line 183, in get_session
super(Session, self).get_session(sid, authenticated)
File "build/bdist.linux-i686/egg/trac/web/session.py", line 57, in get_session
cursor = db.cursor()
File "build/bdist.linux-i686/egg/trac/db/util.py", line 102, in __getattr__
return getattr(self.cnx, name)
AttributeError: 'tuple' object has no attribute 'cursor'
The same error had occurred at r10004, but not previously - I think the previous working version was r9999
I have also recently changed our trac runtime environment to use mod_wsgi instead of the prvious mod_python (apache 2.2). This setup was working prior to updating to trac0.12-stable r10004
Reverting to the prior working version fixes the problem
Our environment is:
- Ubuntu 8.04LTS
- Apache 2.2
- python 2.5
- subversion 1.6.11 (irrelevant I expect)
- mod_wsgi 3.3
Attachments (0)
Change History (10)
comment:1 by , 15 years ago
comment:2 by , 15 years ago
Unfortunately, this is an error during the reporting of an error, so it's difficult to find the cause from this secondary traceback. Could you please look into your trac.log and see if you can find the primary traceback, that is, the traceback right before this one?
comment:3 by , 15 years ago
Here is the contents of trac.log for the error - sorry for the delay.
2010-08-17 14:38:43,388 Trac[main] ERROR: Internal Server Error:
Traceback (most recent call last):
File "build/bdist.linux-i686/egg/trac/web/main.py", line 513, in _dispatch_request
dispatcher.dispatch(req)
File "build/bdist.linux-i686/egg/trac/web/main.py", line 235, in dispatch
resp = chosen_handler.process_request(req)
File "build/bdist.linux-i686/egg/trac/wiki/web_ui.py", line 117, in process_request
page = WikiPage(self.env, pagename)
File "build/bdist.linux-i686/egg/trac/wiki/model.py", line 44, in __init__
self._fetch(name, version, db)
File "build/bdist.linux-i686/egg/trac/wiki/model.py", line 55, in _fetch
db = self.env.get_db_cnx()
File "build/bdist.linux-i686/egg/trac/env.py", line 326, in get_db_cnx
return get_read_db(self)
File "build/bdist.linux-i686/egg/trac/db/api.py", line 90, in get_read_db
return _transaction_local.db or DatabaseManager(env).get_connection()
File "build/bdist.linux-i686/egg/trac/db/api.py", line 152, in get_connection
return self._cnx_pool.get_cnx(self.timeout or None)
File "build/bdist.linux-i686/egg/trac/db/pool.py", line 220, in get_cnx
return _backend.get_cnx(self._connector, self._kwargs, timeout)
File "build/bdist.linux-i686/egg/trac/db/pool.py", line 114, in get_cnx
cnx.close()
AttributeError: 'NoneType' object has no attribute 'close'
comment:4 by , 15 years ago
| Component: | general → database backend |
|---|---|
| Milestone: | → 0.12.1 |
Thanks, that should help.
comment:5 by , 15 years ago
I see this too on my development setup, and the error is reported consistently for certain requests. Exact same error(s). I just don't know why yet…
Christian, I'm on IRC as usual if you want to help me research this one… :-)
follow-up: 7 comment:6 by , 15 years ago
Well, the bug is clear now, but no idea why we didn't detect that mistake earlier when running the patch on t.e.o ;-)
-
trac/db/pool.py
diff --git a/trac/db/pool.py b/trac/db/pool.py
a b class ConnectionPoolBackend(object): 158 158 # Forth best option: Replace a pooled connection with a new one 159 159 elif len(self._active) < self._maxsize: 160 160 # Remove the LRU connection in the pool 161 self._pool.pop(0)161 cnx = self._pool.pop(0) 162 162 self._pool_key.pop(0) 163 163 self._pool_time.pop(0) 164 return ('close', None)164 return ('close', cnx) 165 165 166 166 def _return_cnx(self, cnx, key, tid): 167 167 # Decrement active refcount, clear slot if 1
Could you please try the above fix?
comment:7 by , 15 years ago
Replying to cboos:
why we didn't detect that mistake earlier when running the patch on t.e.o …
… is because this code is only triggered when the same process serves different Trac environments (and different databases even, in case the environments correspond to different schemas), which is not the case on t.e.o which has dedicated processes for each environment.
comment:8 by , 15 years ago
I see that the type of request that fails for me are the "forge"-type requests where same process:thread connects with more than one project and hence needs to open more more than a single connection (separate databases).
The patch fixes this. Goodie.
comment:9 by , 15 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
comment:10 by , 15 years ago
| Owner: | set to |
|---|



Correction, the prior working revision was r10001