I have a fairly standard setup where the application server is separated by a firewall from the database server. The application is using sqlalchemy and the db is postgres.
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:
WARNI [sqlalchemy.pool.QueuePool.0x...7310] [worker 26] Error closing cursor: cursor already closed
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.
any ideas?
Update: I have posted the same question on stackoverflow and got an answer that worked. Have a look at https://stackoverflow.com/questions/6592137/sqlalchemy-fails-to-connect-to-db-after-server-is-idle-for-a-few-hours