Hi all,
I continue to have problems since I switched database to MySQL and I'm not
making any progress in resolving the issue. Basically, I every so often get
the 'MySQL has gone away' error. It mainly occurs when the site has not
been used for a few minutes, although sometimes also appears randomly. I
have both a paster installation and an Apache mod_wsgi installation
connected to the same MySQL database; both get this error. Traceback is at
the end of this mail; it sometimes occurs when loading a user, sometimes
with another call that is the first one of that particular request.
I've asked the SQLAlchemy guys, and the problem seems to be that a
connection is being picked up from the pool and then left to hang,
triggering this error. However, my understanding is that Pyramid deals with
closing the connection at the end of the request. I did have other (script)
code using the DBSession, but I have stopped that cron and even deleted it
from the application directory in order to try and identify the source of
this error.
My ini file contains:
sqlalchemy.pool_recycle = 30
(no other sqlalchemy settings other than the url).
/etc/my.cnf has:
interactive_timeout=3600
__init__ has:
engine = engine_from_config(settings, 'sqlalchemy.')
I'd really appreciate any ideas at all as to how I can make progress with
this - it's been bugging me for some time and I can't deploy to the client
with this still remaining. The only stuff I have found have been
suggestions about including the pool_recycle in ini, but that doesn't seem
to help.
Thanks for any ideas,
Ben
Traceback (most recent call last):
File
/home/benjamin/myapp/staging/lib/python2.6/site-packages/pyramid_exclog-0.5-py2.6.egg/pyramid_exclog/__init__.py,
line 40, in exclog_tween
return handler(request)
File
/home/benjamin/myapp/staging/lib/python2.6/site-packages/pyramid-1.2.1-py2.6.egg/pyramid/router.py,
line 153, in handle_request
response = view_callable(context, request)
File
/home/benjamin/myapp/staging/lib/python2.6/site-packages/pyramid-1.2.1-py2.6.egg/pyramid/config/views.py,
line 292, in rendered_view
result = view(context, request)
File
/home/benjamin/myapp/staging/lib/python2.6/site-packages/pyramid-1.2.1-py2.6.egg/pyramid/config/views.py,
line 402, in _requestonly_view
response = view(request)
File /home/benjamin/myapp/staging/myapp/myapp/views.py, line 107, in home
if request.user:
File
/home/benjamin/myapp/staging/lib/python2.6/site-packages/pyramid-1.2.1-py2.6.egg/pyramid/decorator.py,
line 17, in __get__
val = self.wrapped(inst)
File /home/benjamin/myapp/staging/myapp/myapp/security.py, line 30, in
user
return session.query(User).filter_by(username=userid).one()
File
/home/benjamin/myapp/staging/lib/python2.6/site-packages/SQLAlchemy-0.7.2-py2.6-linux-x86_64.egg/sqlalchemy/orm/query.py,
line 1796, in one
ret = list(self)
File
/home/benjamin/myapp/staging/lib/python2.6/site-packages/SQLAlchemy-0.7.2-py2.6-linux-x86_64.egg/sqlalchemy/orm/query.py,
line 1839, in __iter__
return self._execute_and_instances(context)
File
/home/benjamin/myapp/staging/lib/python2.6/site-packages/SQLAlchemy-0.7.2-py2.6-linux-x86_64.egg/sqlalchemy/orm/query.py,
line 1854, in _execute_and_instances
result = conn.execute(querycontext.statement, self._params)
File
/home/benjamin/myapp/staging/lib/python2.6/site-packages/SQLAlchemy-0.7.2-py2.6-linux-x86_64.egg/sqlalchemy/engine/base.py,
line 1399, in execute
params)
File
/home/benjamin/myapp/staging/lib/python2.6/site-packages/SQLAlchemy-0.7.2-py2.6-linux-x86_64.egg/sqlalchemy/engine/base.py,
line 1532, in _execute_clauseelement
compiled_sql, distilled_params
File
/home/benjamin/myapp/staging/lib/python2.6/site-packages/SQLAlchemy-0.7.2-py2.6-linux-x86_64.egg/sqlalchemy/engine/base.py,
line 1640, in _execute_context
context)
File
/home/benjamin/myapp/staging/lib/python2.6/site-packages/SQLAlchemy-0.7.2-py2.6-linux-x86_64.egg/sqlalchemy/engine/base.py,
line 1633, in _execute_context
context)
File
/home/benjamin/myapp/staging/lib/python2.6/site-packages/SQLAlchemy-0.7.2-py2.6-linux-x86_64.egg/sqlalchemy/engine/default.py,
line 325, in do_execute
cursor.execute(statement, parameters)
File /usr/lib64/python2.6/site-packages/MySQLdb/cursors.py, line 173, in
execute
self.errorhandler(self, exc, value)
File /usr/lib64/python2.6/site-packages/MySQLdb/connections.py, line 36,
in defaulterrorhandler
raise errorclass, errorvalue
OperationalError: (OperationalError) (2006, 'MySQL server has gone away')
'SELECT users.password
--
You received this message because you are subscribed to the Google Groups
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com.
To unsubscribe from this group, send email to
pylons-discuss+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/pylons-discuss?hl=en.