Closed ikrivosheev closed 3 years ago
That's the items?
I write some debug print:
async def read_varint(self):
if self.position == self.current_buffer_size:
self._reset_buffer()
await self._read_into_buffer()
packets = bytearray()
count = 0
while True:
count += 1
try:
packet = self._read_one()
except Exception as e:
print('-' * 10)
print('Position: ', self.position)
print('Current buffer size: ', self.current_buffer_size)
print('Count: ', count)
print('-' * 10)
raise
packets.append(packet)
if packet < 0x80:
break
return leb128.u.decode(packets)
Output:
----------
Position: 13562
Current buffer size: 8688
Count: 1
----------
@long2ice can you make release?
OK
@long2ice I am still facing the exact same issue.
File "./connections/clickhouse_db.py", line 75, in fetchall
await cursor.execute(query)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/asynch/cursors.py", line 61, in execute
response = await execute(query, args=args, with_column_types=True, **execute_kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/asynch/proto/connection.py", line 526, in execute
await self.force_connect()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/asynch/proto/connection.py", line 575, in force_connect
elif not await self.ping():
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/asynch/proto/connection.py", line 246, in ping
packet_type = await self.reader.read_varint()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/asynch/proto/io.py", line 127, in read_varint
packet = self._read_one()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/asynch/proto/io.py", line 117, in _read_one
packet = self.buffer[self.position]
IndexError: bytearray index out of range
Here is my connection pool code
self.pool = await asynch.create_pool(
dsn=self.dsn,
minsize=self.min_size,
maxsize=self.max_size,
)
async with self.pool.acquire() as con:
try:
wrapped_con = Connection(con)
return await func(*args, connection=wrapped_con, **kwargs)
except Exception as e:
log.exception(e)
class Connection:
def __init__(self, connection):
self.asynch_connection = connection
async def fetchone(self, query):
async with self.asynch_connection.cursor(cursor=DictCursor) as cursor:
await cursor.execute(query)
result = cursor.fetchone()
return result
async def fetchall(self, query):
async with self.asynch_connection.cursor(cursor=DictCursor) as cursor:
await cursor.execute(query)
results = cursor.fetchall()
return results
@long2ice I am still facing the exact same issue.
File "./connections/clickhouse_db.py", line 75, in fetchall await cursor.execute(query) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/asynch/cursors.py", line 61, in execute response = await execute(query, args=args, with_column_types=True, **execute_kwargs) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/asynch/proto/connection.py", line 526, in execute await self.force_connect() File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/asynch/proto/connection.py", line 575, in force_connect elif not await self.ping(): File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/asynch/proto/connection.py", line 246, in ping packet_type = await self.reader.read_varint() File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/asynch/proto/io.py", line 127, in read_varint packet = self._read_one() File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/asynch/proto/io.py", line 117, in _read_one packet = self.buffer[self.position] IndexError: bytearray index out of range
Here is my connection pool code
self.pool = await asynch.create_pool( dsn=self.dsn, minsize=self.min_size, maxsize=self.max_size, )
async with self.pool.acquire() as con: try: wrapped_con = Connection(con) return await func(*args, connection=wrapped_con, **kwargs) except Exception as e: log.exception(e)
class Connection: def __init__(self, connection): self.asynch_connection = connection async def fetchone(self, query): async with self.asynch_connection.cursor(cursor=DictCursor) as cursor: await cursor.execute(query) result = cursor.fetchone() return result async def fetchall(self, query): async with self.asynch_connection.cursor(cursor=DictCursor) as cursor: await cursor.execute(query) results = cursor.fetchall() return results
I am facing exactly the same issue.
Clickhouse version: 21.3 Code:
Traceback