long2ice / asynch

An asyncio ClickHouse Python Driver with native (TCP) interface support.
https://github.com/long2ice/asynch
Apache License 2.0
186 stars 43 forks source link

Gracefully handle connections terminated by the server #129

Open nils-borrmann-tacto opened 2 weeks ago

nils-borrmann-tacto commented 2 weeks ago

I added two test cases that locally reproduce a connection closed by the server, and fixed the related issues.

I start a proxy server from port 9001->9000 that kills the connection after it idled for 2 seconds. It can actually kill the connection in two different ways, either gracefully (TCP FIN packet), or ungracefully (TCP RST packet). The former option causes a UnexpectedPacketFromServerError, the latter a ConnectionResetError. Both are be easy to fix by slightly changing the exception handling.

stankudrow commented 2 weeks ago

@nils-borrmann-tacto , hello, could you grant me necessary permissions for coauthoring, please?

nils-borrmann-tacto commented 2 weeks ago

@stankudrow done

stankudrow commented 1 week ago

Relates to the issue #126 , closes the issue #127 .

@gnomeby , @reclosedev , could you possibly help in reviewing this PR?