title: sqlalchemy fails to connect to db after server is idle for a few hours
body: <p>I have a fairly standard setup where the application server is separated by a firewall from the database server. The application us using sqlalchemy and the db is postgres.</p>
  
  <p>The system works fine for a few hours, but once it remains idle for a long period it appears that the communication fails between the server and the db. The error log is:</p>
  
  <pre><code>WARNI [sqlalchemy.pool.QueuePool.0x...7310] [worker 26] Error closing cursor: cursor already closed
  </code></pre>
  
  <p>I set up the connection pool with the 'pool_recylce' setting set to 30mins, so that there are no connections lingering for more than 30 mins. The problem persists.</p>
  
  <p>any ideas?</p>