long2ice / asyncmy

A fast asyncio MySQL/MariaDB driver with replication protocol support
https://github.com/long2ice/asyncmy
Apache License 2.0
259 stars 31 forks source link

Lost connection to MySQL server despite periodic pings #27

Open MarkReedZ opened 2 years ago

MarkReedZ commented 2 years ago

Every 60 seconds I acquire from my pool and ping yet I'm still getting lost connections. Is ping working or is this not the way to prevent this problem? Am I not walking through all connections in the pool?

(2013, 'Lost connection to MySQL server during query')

    await asyncio.sleep(60)

    async with ws.pool.mysql_pool.acquire() as conn:
      await conn.ping(True)
long2ice commented 2 years ago

What about try pool_recycle?

jmsardoy commented 8 months ago

Hi, I'm getting this error with meilsync.

If a make a change on the DB right after starting meilisync, it works fine. But after a little while (to little, one or two minutes), I make a change and it throws this error.

@long2ice Is there a way to keep the connections alive, without messing with db configs, which I don't have access?