question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

In python3.4.1 all tests cause <Task pending _read_data() > warning.

See original GitHub issue

Recently I’ve updated my python to 3.4.1 (debian testing switched to this version), as result every single test in aioredis causes following warning (however no warning with python3.4):

Task was destroyed but it is pending!
task: <Task pending _read_data() at /home/nick/sources/python/aioredis/aioredis/connection.py:78 wait_for=<Future pending cb=[Task._wakeup()]>>

I tried to run tests with PYTHONASYNCIODEBUG=1 and got following exception:

 pending _read_data() at /home/nick/sources/python/aioredis/aioredis/connection.py:78 wait_for=<Future pending cb=[Task._wakeup()]>>
Task was destroyed but it is pending!
source_traceback: Object created at (most recent call last):
  File "runtests.py", line 290, in <module>
    runtests()
  File "runtests.py", line 273, in runtests
    failfast=failfast).run(tests)
  File "/usr/lib/python3.4/unittest/runner.py", line 168, in run
    test(result)
  File "/usr/lib/python3.4/unittest/suite.py", line 87, in __call__
    return self.run(*args, **kwds)
  File "/usr/lib/python3.4/unittest/suite.py", line 125, in run
    test(result)
  File "/usr/lib/python3.4/unittest/case.py", line 625, in __call__
    return self.run(*args, **kwds)
  File "/usr/lib/python3.4/unittest/case.py", line 577, in run
    testMethod()
  File "tests/connection_test.py", line 35, in test_global_loop
    ('localhost', self.redis_port), db=0))
  File "/usr/lib/python3.4/asyncio/base_events.py", line 239, in run_until_complete
    self.run_forever()
  File "/usr/lib/python3.4/asyncio/base_events.py", line 212, in run_forever
    self._run_once()
  File "/usr/lib/python3.4/asyncio/base_events.py", line 912, in _run_once
    handle._run()
  File "/usr/lib/python3.4/asyncio/events.py", line 96, in _run
    self._callback(*self._args)
  File "/usr/lib/python3.4/asyncio/tasks.py", line 298, in _wakeup
    self._step(value, None)
  File "/usr/lib/python3.4/asyncio/tasks.py", line 244, in _step
    result = next(coro)
  File "/usr/lib/python3.4/asyncio/coroutines.py", line 78, in __next__
    return next(self.gen)
  File "/home/nick/sources/python/aioredis/aioredis/connection.py", line 42, in create_connection
    conn = RedisConnection(reader, writer, encoding=encoding, loop=loop)
  File "/home/nick/sources/python/aioredis/aioredis/connection.py", line 63, in __init__
    self._reader_task = asyncio.Task(self._read_data(), loop=self._loop)
task: <Task pending _read_data() at /home/nick/sources/python/aioredis/aioredis/connection.py:78 wait_for=<Future pending cb=[Task._wakeup()]>>
make: *** [test] Error

Any idea how to mute this warning?

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
popravichcommented, Dec 24, 2015

Hi, in your case you sould use at least r.close()and at most:

r.close()
loop.run_until_complete(r.wait_closed())

before exit() call

0reactions
dellis23commented, Feb 13, 2017

@popravich Very helpful, thanks. It might be worth putting in the docs, for example here: http://aioredis.readthedocs.io/en/v0.3.0/api_reference.html It’s a bit confusing to see the Task was destroyed but it is pending! when just following the examples.

Read more comments on GitHub >

github_iconTop Results From Across the Web

In python3.4.1 all tests cause <Task pending _read_data ...
Recently I've updated my python to 3.4.1 (debian testing switched ... In python3.4.1 all tests cause <Task pending _read_data() > warning.
Read more >
Changelog — Python 3.11.1 documentation
gh-99729: Fix an issue that could cause frames to be visible to Python code as they are being torn down, possibly leading to...
Read more >
How can i fix Task was destroyed but it is pending?
To make this happen I create two tasks out of the two new coroutines. ... but it is pending! task: <Task pending name='Task-1'...
Read more >
Tornado Documentation - Read the Docs
Tornado is different from most Python web frameworks. It is not based on WSGI, and it is typically run with only one thread...
Read more >
snowflake-connector-python - PyPI
Bumped cryptography dependency from <39.0.0 to <41.0.0; Fixed a bug where expired OCSP response cache caused infinite recursion during cache loading.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found