asynch
asynch copied to clipboard
Can not connect to Clickhouse version 22.3.8.39
I want to use asynch library with one of the latest Clickhouse versions 22.3.8.39. Got exception
File "/home/zexxonn/DEV/Quantor/momote/backend/app/context.py", line 81, in create_asynch_pool
asynch_pool: "AsynchPool" = await asynch_pool_exit_stack.enter_async_context(
File "/home/zexxonn/.pyenv/versions/3.9.12/lib/python3.9/contextlib.py", line 575, in enter_async_context
result = await _cm_type.__aenter__(cm)
File "/home/zexxonn/.cache/pypoetry/virtualenvs/backend-Ief6SS80-py3.9/lib/python3.9/site-packages/asynch/pool.py", line 53, in __aenter__
self._obj = await self._coro
File "/home/zexxonn/.cache/pypoetry/virtualenvs/backend-Ief6SS80-py3.9/lib/python3.9/site-packages/asynch/pool.py", line 242, in _create_pool
await pool.initialize()
File "/home/zexxonn/.cache/pypoetry/virtualenvs/backend-Ief6SS80-py3.9/lib/python3.9/site-packages/asynch/pool.py", line 176, in initialize
conn = await connect(**self._connection_kwargs)
File "/home/zexxonn/.cache/pypoetry/virtualenvs/backend-Ief6SS80-py3.9/lib/python3.9/site-packages/asynch/connection.py", line 199, in connect
await conn.connect()
File "/home/zexxonn/.cache/pypoetry/virtualenvs/backend-Ief6SS80-py3.9/lib/python3.9/site-packages/asynch/connection.py", line 97, in connect
await self._connection.connect()
File "/home/zexxonn/.cache/pypoetry/virtualenvs/backend-Ief6SS80-py3.9/lib/python3.9/site-packages/asynch/proto/connection.py", line 470, in connect
return await self._init_connection(host, port)
File "/home/zexxonn/.cache/pypoetry/virtualenvs/backend-Ief6SS80-py3.9/lib/python3.9/site-packages/asynch/proto/connection.py", line 457, in _init_connection
await self.receive_hello()
File "/home/zexxonn/.cache/pypoetry/virtualenvs/backend-Ief6SS80-py3.9/lib/python3.9/site-packages/asynch/proto/connection.py", line 241, in receive_hello
raise UnexpectedPacketFromServerError(message)
asynch.errors.UnexpectedPacketFromServerError: Code: 102. Unexpected packet from server rc1b-ceve8zbnw6zcqb0d.mdb.yandexcloud.net:9440 (expected Hello or Exception, got Unknown packet)
With Clickhouse 21.12.2.17 everything work well. I used debugger to understand difference between versions during connection and found that here https://github.com/long2ice/asynch/blob/dev/asynch/proto/connection.py#L226 for CH 22.3.8.39 asynch client receives packet_type == 21. I am connecting with ca_certs and secure=True.
How connection problem can be fixed?
It may happen if you connect to clickhouse via http port instead of TCP.