id,summary,reporter,owner,description,type,status,priority,milestone,component,version,severity,resolution,keywords,cc,branch,changelog,apichanges,internalchanges 3923,Thread deadlock,exarkun@…,Jonas Borgström,"I have trac deployed as a WSGI application. Occassionally it hangs and must be restarted. Inspecting the state of the process reveals threads in two states. One is here: {{{ File ""/usr/lib/python2.4/threading.py"", line 442, in __bootstrap self.run() File ""/usr/lib/python2.4/threading.py"", line 422, in run self.__target(*self.__args, **self.__kwargs) File ""/home/trac/Projects/Twisted/trunk/twisted/python/threadpool.py"", line 148, in _worker context.call(ctx, function, *args, **kwargs) File ""/home/trac/Projects/Twisted/trunk/twisted/python/context.py"", line 59, in callWithContext return self.currentContext().callWithContext(ctx, func, *args, **kw) File ""/home/trac/Projects/Twisted/trunk/twisted/python/context.py"", line 37, in callWithContext return func(*args,**kw) File ""/home/trac/Projects/Twisted/trunk/twisted/web2/wsgi.py"", line 138, in run result = self.application(self.environment, self.startWSGIResponse) File ""/home/trac/Run/trac/external.py"", line 74, in __call__ return self.application(environ, start_response) File ""/home/trac/Run/trac/external.py"", line 115, in tracApplication return trac.web.main.dispatch_request(environ, start_response) File ""/home/trac/Projects/trac/trunk/trac/web/main.py"", line 356, in dispatch_request dispatcher.dispatch(req) File ""/home/trac/Projects/trac/trunk/trac/web/main.py"", line 190, in dispatch req.perm = PermissionCache(self.env, req.authname) File ""/home/trac/Projects/trac/trunk/trac/perm.py"", line 267, in __init__ self.perms = PermissionSystem(env).get_user_permissions(username) File ""/home/trac/Projects/trac/trunk/trac/perm.py"", line 231, in get_user_permissions for perm in self.store.get_user_permissions(username): File ""/home/trac/Projects/trac/trunk/trac/perm.py"", line 109, in get_user_permissions db = self.env.get_db_cnx() File ""/home/trac/Projects/trac/trunk/trac/env.py"", line 182, in get_db_cnx return DatabaseManager(self).get_connection() File ""/home/trac/Projects/trac/trunk/trac/db/api.py"", line 75, in get_connection return self._cnx_pool.get_cnx(self.timeout or None) File ""/home/trac/Projects/trac/trunk/trac/db/pool.py"", line 84, in get_cnx cnx = self._connector.get_connection(**self._kwargs) File ""/home/trac/Projects/trac/trunk/trac/db/sqlite_backend.py"", line 113, in get_connection return SQLiteConnection(path, params) File ""/home/trac/Projects/trac/trunk/trac/db/sqlite_backend.py"", line 159, in __init__ timeout=timeout) File ""/home/trac/Projects/trac/trunk/trac/db/pool.py"", line 48, in __del__ self.close() File ""/home/trac/Projects/trac/trunk/trac/db/pool.py"", line 44, in close self._pool._return_cnx(self.cnx, self._tid) File ""/home/trac/Projects/trac/trunk/trac/db/pool.py"", line 102, in _return_cnx self._available.acquire() }}} Nine are here: {{{ File ""/usr/lib/python2.4/threading.py"", line 442, in __bootstrap self.run() File ""/usr/lib/python2.4/threading.py"", line 422, in run self.__target(*self.__args, **self.__kwargs) File ""/home/trac/Projects/Twisted/trunk/twisted/python/threadpool.py"", line 148, in _worker context.call(ctx, function, *args, **kwargs) File ""/home/trac/Projects/Twisted/trunk/twisted/python/context.py"", line 59, in callWithContext return self.currentContext().callWithContext(ctx, func, *args, **kw) File ""/home/trac/Projects/Twisted/trunk/twisted/python/context.py"", line 37, in callWithContext return func(*args,**kw) File ""/home/trac/Projects/Twisted/trunk/twisted/web2/wsgi.py"", line 138, in run result = self.application(self.environment, self.startWSGIResponse) File ""/home/trac/Run/trac/external.py"", line 74, in __call__ return self.application(environ, start_response) File ""/home/trac/Run/trac/external.py"", line 115, in tracApplication return trac.web.main.dispatch_request(environ, start_response) File ""/home/trac/Projects/trac/trunk/trac/web/main.py"", line 356, in dispatch_request dispatcher.dispatch(req) File ""/home/trac/Projects/trac/trunk/trac/web/main.py"", line 190, in dispatch req.perm = PermissionCache(self.env, req.authname) File ""/home/trac/Projects/trac/trunk/trac/perm.py"", line 267, in __init__ self.perms = PermissionSystem(env).get_user_permissions(username) File ""/home/trac/Projects/trac/trunk/trac/perm.py"", line 231, in get_user_permissions for perm in self.store.get_user_permissions(username): File ""/home/trac/Projects/trac/trunk/trac/perm.py"", line 109, in get_user_permissions db = self.env.get_db_cnx() File ""/home/trac/Projects/trac/trunk/trac/env.py"", line 182, in get_db_cnx return DatabaseManager(self).get_connection() File ""/home/trac/Projects/trac/trunk/trac/db/api.py"", line 75, in get_connection return self._cnx_pool.get_cnx(self.timeout or None) File ""/home/trac/Projects/trac/trunk/trac/db/pool.py"", line 65, in get_cnx self._available.acquire() }}} The WSGI container uses a threadpool with ten threads for the application. I have only had instrumentation in place to inspect this state on one occassion so far, so I don't know if this is the typical state in which the process ends. The server is running r3798 with the db_pool_timeout-r3868.patch from #3504. Python is 2.4.2, SQLite is 3.3.7. PySQLite is 2.3.2. Subversion is 1.4.0. glibc is 2.3.5. Linux is 2.6.12.",defect,closed,high,0.11.1,general,0.10,critical,fixed,database pool deadlock twisted verify,exarkun@… moo.lighttpd@…,,,,