Task was destroyed but is is pending
See original GitHub issueHi, I’m receiving multiple messages stating the following:
Task was destroyed but it is pending!
task: <Task pending coro=<RedisPool._do_close() running at /Users/manuelmiranda/.virtualenvs/redis-cache/lib/python3.5/site-packages/aioredis/pool.py:102> wait_for=<Future pending cb=[Task._wakeup()]>>
Task was destroyed but it is pending!
task: <Task pending coro=<RedisConnection._read_data() running at /Users/manuelmiranda/.virtualenvs/redis-cache/lib/python3.5/site-packages/aioredis/connection.py:131> wait_for=<Future pending cb=[Task._wakeup()]> cb=[Future.set_result()]>
Task was destroyed but it is pending!
The code I’m using:
async def _connect(self):
if self._pool is None:
self._pool = await aioredis.create_pool(
(self.endpoint, self.port))
return await self._pool
async def get(self, key):
with await self._connect() as client:
await client.get(key)
Am I missing something? Isn’t the context_manager supposed to close the pool when exits?
Thanks!
Issue Analytics
- State:
- Created 7 years ago
- Comments:14 (10 by maintainers)
Top Results From Across the Web
Please explain "Task was destroyed but it is pending!" after ...
The problem comes from closing the loop immediately after cancelling the tasks. As the cancel() docs state.
Read more >Task was destroyed but it is pending · Issue #1634 - GitHub
Problem with celery task, that aggregates media from some channels. Previously i tried "sync" version of TelethonClient and got same errors.
Read more >Task was destroyed but it is pending! - Questions and Help
I'm having a hard time trying to avoid the following issue: Task was destroyed but it is pending! This is related to the...
Read more >Common Mistakes Using Python3 asyncio
3 Task was destroyed but it is pending! The cause of this problem is that the EventLoop closed right after canceling pending tasks....
Read more >ERROR Task was destroyed but it is pending! - Google Groups
Dear oTree community,. Can anyone help me with the following error that I receive in the command line (Mac)? I get it since...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
just solved this by downgrade python to 3.6
Nope, in pytest 3.0 if a fixture has a
yieldit implicitly becomes an “old” yield_fixture. It works out of the box now.D’oh! I thought
close()andwait_closed()were just the sync and async ways to close the redis connection respectively, my bad. After transforming the fixture to:works perfectly. Thanks a lot for the help!