I use webpy as a web server, and it handle user request and do some mysql database operation. I create a class to process business and use my own MySQLdb wrapper, and it create a database connection as a long connection.
at the beginning, the class works fine, after several times, it can not SELECT data from database, and I am sure the database works fine. the no any errors and no any warns.
please give me suggestions. Is it a defeat of webpy or MySQLdb ?
My class of MySQLdb wrapper works fine in other places. It is much convenient than the web.db. I can attach my wrapper if possible, I just don't know how.
I can solve this problem in this way, for each request, I create a business instance, and destroy it after the business finished. the connection problem is solved just like you mentioned.
But the problem is performance, My business class instance contain much content, it becomes much slower.
I think this problem has nothing to do with muti-threading, webpy server is running with one process and one thread.
And webpy rewrite my sys.stdout and sys.stderr, it becomes difficult when I trace the problem.
Now, I am add logging in MySQLdb, hope to solve this problem.