Hi,
After leaving my app running for a while, when I come back to access
it, I get an error in Framework that is from pymysql reporting that
the connection to the server has been lost (because it timed out from
inactivity presumably). If I refresh the page a couple of times, the
error goes away. I assume this is because DAL opens a new connection
after finding that all the available connections have closed. This
provides a poor impression for users.
I have encountered this in non-web based code and so I wrap all of my
database accesses with a function that first trys to ping the
connection by doing a db.commit, and if it fails, reconnects to the
server. Can something like this be added to dal.py? Is there a better
way to handle this?

The exact source of the error is here

File "/home/dl/trunkw2p/web2py/gluon/main.py", line 506, in wsgibase
    BaseAdapter.close_all_instances('commit')

and sometimes here:

File "/home/dl/trunkw2p/web2py/gluon/main.py", line 570, in wsgibase
    BaseAdapter.close_all_instances('rollback')


Thanks,
G

Reply via email to