I'm running SA 0.4 on 3 instances of cherrypy, each with 10 threads.
Each thread creates its own Session object when it initializes, and
reuses the Session continually. This is what my SA init code looks
like:
db = sa.create_engine("mysql://%s:%s@%s/%s" % (DBUSER, DBPASSWORD,
DBHOST, DBINSTANCE), pool_size=40, pool_recycle=3600, max_overflow=2)
Session = orm.sessionmaker(bind=db, autoflush=True,
transactional=True)
After leaving the dev server alone overnight, it comes up with the
error:
OperationalError: (OperationalError) (2006, 'MySQL server has gone
away')
Am I using pool_recycle incorrectly, or is there something else I
should be doing to ensure Session pulls a good connection from the
pool?
Thanks for any help or suggestions. SA is mindblowingly amazing.
Jeff
you'd have to close() the Session when youre done with it, or just
discard it; with a transactional=True session, its going to hold on
to a connection persistently. you can turn on echo_pool=True to view
connection checkout activity.
Thanks so much,
Jeff