Dear SQLAlchemists,
I'm using SA 0.2.8 with MySQL and experiencing problems with connections
timeout ("MySQL server has gone away"). As of 0.2.8, there is a pool_recycle
option which ensures connections are beeing recycled when a given amount of
time has passed. The problem is not all connections from the pool are
recycled, resulting in the "MySQL server has gone away" error...
This occurs while using SA with CherryPy (multithreaded environment). Looking
at the code, I've found the recycle timeout is specific to the pool, not for
each connection. This means (eg., two connections in the pool):
- assume connection #1 and #2 are used simultenaously
- wait pool_recycle secs
- while using connection #1, it's recycled as waiting time > pool_recycle.
- now if connection #2 is used, it won't be recycled as the pool timeout has
been resetted... This connection #2 will produce the infamous "MySQL server
has gone away" error...
I'm been able to reproduce this case, configuring MySQL server to timeout
connection after 15 secs (for testing purpose...), and pool_recycle=10.
Am I understanding well ? Is this a bug (what is the expected behavior of
pool_cycle option) ?
As of 0.2.4, which did not provide pool_recycle option, I had to write a pool
class which was pinging the server to test each connection. Do I have to
reconsider this solution, specific to MySQL, or is there a generic solution
using SA 0.2.8 ?
Thanks for your help/advices.
Cheers,
Seb
--
Sébastien LELONG
[EMAIL PROTECTED]
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Sqlalchemy-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users