Frequent 500 error on web app

53 views
Skip to first unread message

Juju

unread,
Nov 23, 2011, 5:08:46 AM11/23/11
to PyF Framework Users
and i think it is related to sqlite access as this log seems to say :

Error - <class 'sqlalchemy.exc.ProgrammingError'>: (ProgrammingError)
Cannot operate on a closed database. None [{}]
URL: http://192.168.250.136:8080/events/10.json
File '/usr/local/lib/python2.7/dist-packages/WebError-0.10.3-py2.7.egg/
weberror/errormiddleware.py', line 162 in __call__
app_iter = self.application(environ, sr_checker)
File '/usr/local/lib/python2.7/dist-packages/TurboGears2-2.1.3-
py2.7.egg/tg/configuration.py', line 825 in remover
return app(environ, start_response)
File '/usr/local/lib/python2.7/dist-packages/repoze.tm2-1.0b2-
py2.7.egg/repoze/tm/__init__.py', line 24 in __call__
result = self.application(environ, save_status_and_headers)
File '/usr/local/lib/python2.7/dist-packages/repoze.who-1.0.19-
py2.7.egg/repoze/who/middleware.py', line 85 in __call__
self.add_metadata(environ, classification, identity)
File '/usr/local/lib/python2.7/dist-packages/repoze.who-1.0.19-
py2.7.egg/repoze/who/middleware.py', line 179 in add_metadata
plugin.add_metadata(environ, identity)
File '/usr/local/lib/python2.7/dist-packages/repoze.who.plugins.sa-1.0-
py2.7.egg/repoze/who/plugins/sa.py', line 194 in add_metadata
identity['user'] = self.get_user(identity['repoze.who.userid'])
File '/usr/local/lib/python2.7/dist-packages/repoze.who.plugins.sa-1.0-
py2.7.egg/repoze/who/plugins/sa.py', line 64 in get_user
return query.one()
File '/usr/local/lib/python2.7/dist-packages/SQLAlchemy-0.6.8-
py2.7.egg/sqlalchemy/orm/query.py', line 1678 in one
ret = list(self)
File '/usr/local/lib/python2.7/dist-packages/SQLAlchemy-0.6.8-
py2.7.egg/sqlalchemy/orm/query.py', line 1721 in __iter__
return self._execute_and_instances(context)
File '/usr/local/lib/python2.7/dist-packages/SQLAlchemy-0.6.8-
py2.7.egg/sqlalchemy/orm/query.py', line 1726 in
_execute_and_instances
mapper=self._mapper_zero_or_none())
File '/usr/local/lib/python2.7/dist-packages/SQLAlchemy-0.6.8-
py2.7.egg/sqlalchemy/orm/session.py', line 724 in execute
clause, params or {})
File '/usr/local/lib/python2.7/dist-packages/SQLAlchemy-0.6.8-
py2.7.egg/sqlalchemy/engine/base.py', line 1191 in execute
params)
File '/usr/local/lib/python2.7/dist-packages/SQLAlchemy-0.6.8-
py2.7.egg/sqlalchemy/engine/base.py', line 1269 in
_execute_clauseelement
parameters=params
File '/usr/local/lib/python2.7/dist-packages/SQLAlchemy-0.6.8-
py2.7.egg/sqlalchemy/engine/base.py', line 1382 in
__create_execution_context
None, None)
File '/usr/local/lib/python2.7/dist-packages/SQLAlchemy-0.6.8-
py2.7.egg/sqlalchemy/engine/base.py', line 1377 in
__create_execution_context
connection=self, **kwargs)
File '/usr/local/lib/python2.7/dist-packages/SQLAlchemy-0.6.8-
py2.7.egg/sqlalchemy/engine/default.py', line 392 in __init__
self.cursor = self.create_cursor()
File '/usr/local/lib/python2.7/dist-packages/SQLAlchemy-0.6.8-
py2.7.egg/sqlalchemy/engine/default.py', line 534 in create_cursor
return self._connection.connection.cursor()
File '/usr/local/lib/python2.7/dist-packages/SQLAlchemy-0.6.8-
py2.7.egg/sqlalchemy/pool.py', line 423 in cursor
c = self.connection.cursor(*args, **kwargs)
ProgrammingError: (ProgrammingError) Cannot operate on a closed
database. None [{}]

Should i use another DB or is there a way to avoid this ?

If i have to use another DB how do I handle it ?

Regards

Jonathan Schemoul

unread,
Nov 23, 2011, 5:36:54 AM11/23/11
to pyf-...@googlegroups.com
SQLite is rather limited for concurrent uses.

I recommend using Postgresql for live systems.

You just have to change the sqlalchemy uri in your configuration .ini and redo a bootstrap.

Jon

Mathieu Bridon

unread,
Nov 23, 2011, 5:40:49 AM11/23/11
to pyf-...@googlegroups.com
On Wed, 2011-11-23 at 11:36 +0100, Jonathan Schemoul wrote:
> SQLite is rather limited for concurrent uses.
>
> I recommend using Postgresql for live systems.

That could probably go in a README somewhere, or in the online
documentation. ;)


--
Mathieu


Reply all
Reply to author
Forward
0 new messages