Closed aiportal closed 7 years ago
Not sure looks like an issue in pymysql, the database driver, as opposed to peewee.
I have a same problem. with the same env: peewee + pymysql + uwsgi(multi processes. every process have only 1 thread running)
at the beginning, errors comes about 8 hours since uwsgi starts(about 10k queries). With there is more and more user, it crashes faster and faster. Now it will crash every hour.
I tried to use PooledMySQLConnection, but havn't solve this problem. But why a PooledConnection can still suffer a "connection problem"? Keep every connection alive and usable is the duty for a ConnectionPool, isn't it?
Keep every connection alive and usable is the duty for a ConnectionPool, isn't it?
If you read the code in the playhouse.pool
module you'll see that Peewee does this when a connection is requested. It verifies that the connection is usable before returning it to the user, using an implementation-specific method for each db driver. MySQL uses the "ping()" method.
My code in flask is like this:
And my web app is under uwsgi.
I found exception log in uwsgi log file.
Why this error happens and how to fix it?