python - MySQL server has gone away -


i've moved local web.py/apache setup shared host , i'm trying match home configuration. 1 issue popping operationalerror "mysql server has gone away". searching around internet, people come across error tended inactive space of hours. happens me between seconds.

i've confirmed using mod_wsgi's application() function example in fact running in daemon mode. 1 issue though, concerns me if spit out web.ctx.orm error log, appears new object each request. shouldn't sqlalchemy session object same between page requests?

here's python code , portion of apache setup. there cause problems on new machine hadn't had before on home machine?

def load_sqla(handler):     web.ctx.orm = scoped_session(sessionmaker(bind=engine))     try:         try:             return handler()         except web.httperror:             web.ctx.orm.commit()             raise         except:             web.ctx.orm.rollback()             raise     finally:         web.ctx.orm.commit()         # if above alone doesn't work, uncomment         # following line:         web.ctx.orm.expunge_all()  ... urls , controllers ...  app = web.application(urls, globals(), autoreload=false) app.add_processor(load_sqla) application = app.wsgifunc() 

and here's portion of apache setup.

wsgidaemonprocess app processes=1 threads=1 python-path=/home/net/ public_html/myapp wsgiprocessgroup app wsgiscriptalias /myapp /home/net/public_html/myapp/managio.py <directory "/home/stratton/public_html/myapp">  options indexes multiviews followsymlinks  allowoverride none  order allow,deny  allow </directory>  

check docs at: http://code.google.com/p/modwsgi/wiki/configurationdirectives#wsgidaemonprocess

setting processes=1 leaves multiprocessing on, may why you're getting concurrent access same sql connection.

also appears you're using sqlalchemy, maybe try turning on queuepool or nullpool use when make engine?


Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -