[Twisted-Python] Twisted server connection loss with Mysql

Dave Peticolas dave at krondo.com
Thu Jun 2 21:54:12 EDT 2005

On Thu, 2005-06-02 at 14:20 -0400, James Y Knight wrote:
> On Jun 2, 2005, at 8:47 AM, Raghul Jagan wrote:
> >          I also tried using the "cp_reconnect=1" for my twisted  
> > server.The first time it works but  the same error ocurrs after  
> > that .Is there anyway to solve this problem? I also tried by  
> > changing the value "reconnect=True" in adbapi.py file,the same  
> > error occurs what will be my problem? My machine configuration is
> The expected behavior of cp_reconnect is not to retry the query  
> automatically if it fails, because doing so could have undefined  
> consequences. Really, it probably could retry when the error was on  
> the query, not on the commit, but it doesn't currently.
> If you have a connection pool size of 10, expect to see 10 queries  
> fail before everything's working perfectly again, as each thread  
> notices its connection has died (after failing to make the query) and  
> closes it. In your app, you can either catch ConnectionLost errors  
> and retry the queries yourself or live with 10 queries failing after  
> restarting the database.

Unfortunately, mysqldb doesn't throw an exception when you call
cursor() on a closed connection so the exception doesn't happen
until the query itself. Adding an option to adbapi to retry queries
on a failed connection shouldn't be too hard, I'll add that to the


More information about the Twisted-Python mailing list