Skip to content

Timeout on connection.ping #444

Open
@ssbbkn

Description

@ssbbkn

Hi! I'm using aiomysql 0.0.20. I experienced an issue on connection.ping() command. I'm using a connection pool. Problem appears when connection is once successfully acquired and after some time network problem appears. Before every request to MySQL database i'm calling connection.ping(reconnect=True) command. Connection believes that self._writer is not None and self._reader is not None so await self._read_ok_packet() is called on line 453. And there happens this:

 try:
     packet_header = await self._read_bytes(4)
 except asyncio.CancelledError:
     self._close_on_cancel()
     raise

on line 560 in connection.py.
self._read_bytes(4) hangs forever until future is cancelled. In my case, future can be cancelled only if client cancels request to my aiohttp web server. Maybe there should be internal timeouts on this operation like asyncio.wait_for?
P.S. I tried to wrap connection.ping(reconnect=True) with asyncio.wait_for() with my own timeouts, but this leads to the same error as #438 on the next time i'm trying to call connection.ping(reconnect=True).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions