Sometimes it broke by concurrent.futures._base.CancelledError
- 主要語言
- Python
- 星號
- 1.9k
- 分支
- 272
- PR 合併指標
- 30 天內沒有已合併 PR
描述
When I using Aiomysql in a sanic high concurrency web server:
``` python
async with self._pool.acquire() as conn:
async with conn.cursor() as cur:
await cur.execute(query, param)
if is_all:
res = await cur.fetchall()
else:
res = await cur.fetchone()
```
Sometimes it broken this error:
``` text
Traceback (most recent call last):
File "/usr/local/mycodes/amysql.py", line 249, in query
res = await cur.fetchone()
File "/usr/local/lib/python3.6/site-packages/aiomysql/utils.py", line 103, in __aexit__
await self._pool.release(self._conn)
concurrent.futures._base.CancelledError
```
or
``` text
Traceback (most recent call last):
File "/usr/local/mycodes/amysql.py", line 243, in query
async with self._pool.acquire() as conn:
File "/usr/local/lib/python3.6/site-packages/aiomysql/utils.py", line 98, in __aenter__
self._conn = await self._coro
File "/usr/local/lib/python3.6/site-packages/aiomysql/pool.py", line 133, in _acquire
async with self._cond:
File "/usr/lib64/python3.6/asyncio/locks.py", line 79, in __aenter__
yield from self.acquire()
File "/usr/lib64/python3.6/asyncio/locks.py", line 181, in acquire
yield from fut
concurrent.futures._base.CancelledError
```
About 1000 request in 10 seconds will cause this error.
What can I do for avoiding this error?
貢獻指南
評估
這個 Issue 還沒有評估資料。