On Oct 23, 2007, at 1:36 PM, jeffcodefork wrote:

>
> Hi,
>
> 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:[EMAIL PROTECTED]/%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?
>

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.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to