Modify ↓
Opened 9 years ago
Last modified 14 months ago
#12460 new defect
Environment.shutdown() drops all connections for both self and other environments in connection pool
Reported by: | Jun Omae | Owned by: | |
---|---|---|---|
Priority: | normal | Milestone: | next-stable-1.6.x |
Component: | database backend | Version: | |
Severity: | normal | Keywords: | |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
I think that result means Environment.shutdown()
can wrongly close a database connection used for a other request on multi-threads in trac/web/main.py.
$ ~/venv/trac/1.0.10/bin/python Python 2.5.6 (r256:88840, Oct 21 2014, 22:49:55) [GCC 4.8.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from __future__ import with_statement >>> from trac.test import EnvironmentStub >>> def fn(): ... env1 = EnvironmentStub() ... env2 = EnvironmentStub() ... with env1.db_query as db: ... print(db('SELECT * FROM system')) ... print(env2.db_query('SELECT * FROM system')) ... env2.shutdown() ... print(db('SELECT * FROM system')) ... >>> fn() [(u'database_version', u'29')] [(u'database_version', u'29')] Traceback (most recent call last): File "<stdin>", line 1, in <module> File "<stdin>", line 8, in fn File "/home/jun66j5/venv/trac/1.0.10/lib/python2.5/site-packages/trac/db/api.py", line 184, in __exit__ self.db.close() File "/home/jun66j5/venv/trac/1.0.10/lib/python2.5/site-packages/trac/db/pool.py", line 51, in close self._pool._return_cnx(cnx, self._key, self._tid) File "/home/jun66j5/venv/trac/1.0.10/lib/python2.5/site-packages/trac/db/pool.py", line 166, in _return_cnx assert (tid, key) in self._active AssertionError
Attachments (0)
Change History (4)
comment:1 by , 9 years ago
Summary: | Environment.shutdown() drops all connections for both self and other environements in connection pool → Environment.shutdown() drops all connections for both self and other environments in connection pool |
---|
comment:2 by , 8 years ago
Milestone: | next-stable-1.0.x → next-stable-1.2.x |
---|
comment:3 by , 5 years ago
Milestone: | next-stable-1.2.x → next-stable-1.4.x |
---|
Note:
See TracTickets
for help on using tickets.
Moved ticket assigned to next-stable-1.0.x since maintenance of 1.0.x is coming to a close. Please move the ticket back if it's critical to fix on 1.0.x.