[mod_python] 2006 "MySQL server has gone away" failures

Fred of UrlBit.Us fred at urlbit.us
Fri Jan 12 10:45:21 EST 2007


Hello, all.

I intend to use mod_python for a couple of major websites, but I am running 
into an annoying problem.

I've seen something similar posted elsewhere, but no firm resolution.

My mod_python server will run just fine for a while following a restart of 
Apache, but after some time I get the following OperationalError exception:

OperationalError: (2006, 'MySQL server has gone away')

I can't seem to nail this one down, or even why it would happen. I even tried 
pinging the connection early on in the handler, but still no dice.

A restart of the server eliminates the problem for a while. Also, sometimes 
the problem goes away on its own (but comes back later). And of course, when 
I am sitting there trying to reproduce the problem, it works perfectly!

Any clues or suggestions would be extremely helpful.

Setup: Apache 2, Python 2.5, mod_python 3.2.10

stack dump:

ERROR In PyClops plugin <module 'app.urlbit' 
from '/home/urlbit/site/web/php/app/urlbit/__init__.py'> 
            Traceback (most recent call last):
  File "/home/ecms/py/pyclops/plugins/__init__.py", line 34, in 
_application_dispatcher
    if plug.handle(pyreq):
  File "/home/urlbit/site/web/php/app/urlbit/__init__.py", line 52, in handle
    psp.handle(pyreq)
  File "/home/ecms/py/pyclops/psp.py", line 25, in handle
    p.run()
  File "/usr/local/lib/python2.5/site-packages/mod_python/psp.py", line 213, 
in run
    exec code in global_scope
  File "/home/urlbit/site/web/create.html", line 100, in <module>
  File "/usr/local/lib/python2.5/site-packages/MySQLdb/cursors.py", line 163, 
in execute
    self.errorhandler(self, exc, value)
  File "/usr/local/lib/python2.5/site-packages/MySQLdb/connections.py", line 
35, in defaulterrorhandler
    raise errorclass, errorvalue
OperationalError: (2006, 'MySQL server has gone away')

-- Fred
http://urlbit.us
Bite those long URLs!


More information about the Mod_python mailing list