The mysql has gone away thing: mysql server timeout:60 (1 min) I read the source code of SA , and figure out the following solutions : sl1 --> set pool_size=1 and max_overflow #this will close all connections in pool,because the only conn is closed by my app with (session.close(),connection.close(), or result.close() and all overflow conn are closed and discarded when recycling to pool
this solution doesn't work) sl2 --> set pool_recycle = 50 #recycle conn before mysql timeout 50-60=10 10s for recycle is needed sl3 --> set poolclass=NullPool #don't use pool strategy sl4 --> add poollistener sl5 --> set pool_recycle=1 or 0 # ensure to reclye and create new conn when check out at any time after try all these 5 solutions ,the mysql has gone away problem is still there !!! I asume the pool has succeffuly recycled the timeout connections ,all connections we use are new /fresh connection fetched from the DBAPI,and Exception comes again and again.why???? may be , that is because our code has used some connection and forget to close them,and these connecions are not being managed by pool any more (I think connecions not closed are out of control of pool .I find this in source code in Connection Class's close method--> then call _ConnectionFairy . close-->then call fanalizeFairy --> then pool.return_conn). So we should close all session or resultpoxy object in our code . And we do this,this time the "mysql has gone away '' has gone away!!!! sl6 --> write new pool implementation sl7 --> rewrite Connection class of SA These two are difficult and may introduce more problem so I don't use them. hehehe. And , one more thing to mention: Why Connection class in db backend.base alway dispose the underlying engine and pool whenever there is a DBAPI Error and e.args in (2006,2000.....)? why on timeout connection will cause all other connections in pool being closed ?? why not try one more times to finish the work before raise this exception?? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---