title: Twisted adbapi cp_reconnect not working
body: <p>I have a cyclone web service that talks to a MySQL database. When there is no activity for a while (more than 8 hours I'm guessing), I get the following error unti I restart the web service:</p>
  
  <blockquote>
    <p>_mysql_exceptions.OperationalError: (2006, 'MySQL server has gone away')</p>
  </blockquote>
  
  <p>I've seen <a href="https://stackoverflow.com/questions/7656499/twisted-mysqldb-and-2006-mysql-server-has-gone-away-using-twisted-adbapi">this post regarding cp_reconnect</a>, and I have implemented this when creating my connection pool:</p>
  
  <pre><code>pool = adbapi.ConnectionPool("MySQLdb", host=self.host, user=self.user,
      passwd=self.password, db=self.database, cursorclass=MySQLdb.cursors.DictCursor,
      cp_reconnect=True)
  </code></pre>
  
  <p>I would have thought this would have fixed it, and it seemed to for a while, but now I'm seeing the "MySQL server has gone away" error again after there is no activity on the server for a while.</p>
  
  <p>I have read <a href="http://dev.mysql.com/doc/refman/5.0/en/server-system-variables.html#sysvar_wait_timeout" rel="nofollow noreferrer">this MySQL documentation regarding wait_timeout</a>, and I could fix it that way I suppose, but why doesn't the cp_reconnect feature work for me? I am interpreting the adbapi docs to mean that if you specify the cp_reconnect parameter, that adbadpi will handle the error sent by MySQL and re-attempt the query for you. So basically you don't have to handle the error directly in your code. Am I misunderstanding that?</p>