aiomysql icon indicating copy to clipboard operation
aiomysql copied to clipboard

AioMySQL lost connection during query

Open xrokz opened this issue 7 years ago • 4 comments

i want the aiomysql never git stoped from getting lost how ?

xrokz avatar Feb 04 '19 15:02 xrokz

GitMate.io thinks possibly related issues are https://github.com/aio-libs/aiomysql/issues/286 (Remove a connection from aiomysql.Pool), https://github.com/aio-libs/aiomysql/issues/166 (Aborted connection), https://github.com/aio-libs/aiomysql/issues/330 (Lost connection to MySQL server during query), https://github.com/aio-libs/aiomysql/issues/158 (aiomysql enabled cache?), and https://github.com/aio-libs/aiomysql/issues/11 (rename Connection.wait_closed()).

aio-libs-bot avatar Feb 04 '19 15:02 aio-libs-bot

Issues isn't for questions - you can use stackoverflow for questions. If you use a pool you can set pool_recycle=60 when creating it and connections open for 60 seconds without being used will be closed and reopened.

To make this an actual issue the documentation needs to be updated to cover pool_recycle. Should the pool example be updated to use pool_recycle? It would save newbies from hitting this problem perhaps.

An example to handle exceptions may be useful as well. It could show how to catch this exception and reconnect perhaps.

MarkReedZ avatar Feb 10 '19 16:02 MarkReedZ

@MarkReedZ Yeah, I think the doc about pool_recycle should be updated. Besides, how about renaming it to pool_recycle_timeout to avoid misunderstanding?

wtdcode avatar Mar 30 '19 04:03 wtdcode

Yeah, looking at my code renaming it would be a good idea as it isn't clear. I'll look at making a PR in a few days if I have time.

MarkReedZ avatar Mar 31 '19 21:03 MarkReedZ