Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aiohttp: RuntimeWarning: coroutine 'noop' was never awaited (4.0.0a1-py3.6 / 3.6.2-py3.8) #622

Open
4 of 9 tasks
jeremyschulman opened this issue Feb 17, 2020 · 7 comments
Milestone

Comments

@jeremyschulman
Copy link

jeremyschulman commented Feb 17, 2020

Description

When using the lastest slackclient, which pulls in the aiohttp in setup.py with

install_requires=["aiohttp>3.5.2"],

Results in aiohttp version 4.0.0.a1. When using this version I noticed the following output when invoking the WebClient api calls, for example chat_postMessage

/Users/jeremy/venv/lib/python3.6/site-packages/aiohttp-4.0.0a1-py3.6-macosx-10.14-x86_64.egg/aiohttp/client.py:977: RuntimeWarning: coroutine 'noop' was never awaited

If I downgraded the version of aiohttp to < 4.0, I obtain version 3.6.2 . I no longer see the above issue when using this version.

I don't know if this issue rises to the level of a "bug" per-se since I don't see any issue in my app; and I believe this might just be a warning. Unsure. I did find this one related bug:
aio-libs/aiohttp#4282.

What type of issue is this? (place an x in one of the [ ])

  • bug
  • enhancement (feature request)
  • question
  • documentation related
  • testing related
  • discussion

Requirements (place an x in each of the [ ])

  • I've read and understood the Contributing guidelines and have done my best effort to follow them.
  • I've read and agree to the Code of Conduct.
  • I've searched for any related issues and avoided creating a duplicate issue.

Bug Report

Filling out the following details about bugs will help us solve your issue sooner.

Reproducible in:

slackclient version: 2.0

python version: 3.6.8

OS version(s): MacOS Mojave

Steps to reproduce:

  1. Use aiohttp >= 4.0
  2. Execute any WebClient api call
  3. observe the RuntimeWarning as noted
  4. Downgrade aiohttp < 4.0
  5. Re-execute any WEbClient api call
  6. Do not observe the RuntimeWarning.

Expected result:

Ideally be able to use the latest aiohttp library and not see this RuntimeWarning

Actual result:

Currently observing RuntimeWarning with aiohttp > 4.0

Attachments:

Logs, screenshots, screencast, sample project, funny gif, etc.

@stevengill stevengill added the needs info An issue that is claimed to be a bug and hasn't been reproduced, or otherwise needs more info label Feb 18, 2020
@stevengill
Copy link
Member

thanks for reporting this @jeremyschulman!

Lets keep this issue open for a little bit to see if others run into this and if it is actually causing issues with running the library (or if it is just a warning)

@jeremyschulman
Copy link
Author

@stevengill - understood. thank you. Look forward to hearing back from you on any other users experiencing this. Did you happen to try to reproduce and see the same result? Just curious if this is a me problem.

@dima-kov
Copy link

dima-kov commented Mar 4, 2020

Also, experienced the same problem. There is an interesting point: the error happened only when I entered tracemalloc.start(). Without tracemalloc everything works fine. Well, except memory leak and I used tracemalloc to find what's happening.

Traceback:

/usr/local/lib/python3.8/site-packages/aiohttp/client.py:977: RuntimeWarning: coroutine 'noop' was never awaited
  self._resp.release()
Object allocated at (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/aiohttp/client_reqrep.py", lineno 869
    return noop()

Version: 4.0.0a1 (it's ok on 3.6.2)

@seratch seratch added area:concurrency Issues and PRs related to concurrency Version: 2x web-client labels Apr 3, 2020
@seratch seratch added this to the 3.0.0 milestone Apr 28, 2020
@pjvv
Copy link

pjvv commented Apr 29, 2020

Also experiencing this issue when using the slack client as a logging handler.

@seratch
Copy link
Member

seratch commented May 20, 2020

Note: I observe this warning with aiohttp 3.6.2 + Python 3.8.x while it doesn't appear with Python 3.7.x. It may be related to the internals of asyncio or the combination of aiohttp and python standard APIs.

(env) $ python setup.py validate
running validate
Installing test dependencies…
/Users/ksera/github/python-slackclient/env/bin/python -m pip install pytest pytest-cov codecov flake8 black psutil
Requirement already satisfied: pytest in ./env/lib/python3.8/site-packages (5.4.1)
Requirement already satisfied: pytest-cov in ./env/lib/python3.8/site-packages (2.8.1)
Requirement already satisfied: codecov in ./env/lib/python3.8/site-packages (2.0.22)
Requirement already satisfied: flake8 in ./env/lib/python3.8/site-packages (3.8.0)
Requirement already satisfied: black in ./env/lib/python3.8/site-packages (19.10b0)
Requirement already satisfied: psutil in ./env/lib/python3.8/site-packages (5.7.0)
Requirement already satisfied: py>=1.5.0 in ./env/lib/python3.8/site-packages (from pytest) (1.8.1)
Requirement already satisfied: pluggy<1.0,>=0.12 in ./env/lib/python3.8/site-packages (from pytest) (0.13.1)
Requirement already satisfied: attrs>=17.4.0 in ./env/lib/python3.8/site-packages (from pytest) (19.3.0)
Requirement already satisfied: wcwidth in ./env/lib/python3.8/site-packages (from pytest) (0.1.9)
Requirement already satisfied: packaging in ./env/lib/python3.8/site-packages (from pytest) (20.3)
Requirement already satisfied: more-itertools>=4.0.0 in ./env/lib/python3.8/site-packages (from pytest) (8.2.0)
Requirement already satisfied: coverage>=4.4 in ./env/lib/python3.8/site-packages (from pytest-cov) (5.1)
Requirement already satisfied: requests>=2.7.9 in ./env/lib/python3.8/site-packages (from codecov) (2.23.0)
Requirement already satisfied: mccabe<0.7.0,>=0.6.0 in ./env/lib/python3.8/site-packages (from flake8) (0.6.1)
Requirement already satisfied: pyflakes<2.3.0,>=2.2.0 in ./env/lib/python3.8/site-packages (from flake8) (2.2.0)
Requirement already satisfied: pycodestyle<2.7.0,>=2.6.0a1 in ./env/lib/python3.8/site-packages (from flake8) (2.6.0)
Requirement already satisfied: appdirs in ./env/lib/python3.8/site-packages (from black) (1.4.3)
Requirement already satisfied: typed-ast>=1.4.0 in ./env/lib/python3.8/site-packages (from black) (1.4.1)
Requirement already satisfied: pathspec<1,>=0.6 in ./env/lib/python3.8/site-packages (from black) (0.8.0)
Requirement already satisfied: click>=6.5 in ./env/lib/python3.8/site-packages (from black) (7.1.2)
Requirement already satisfied: regex in ./env/lib/python3.8/site-packages (from black) (2020.4.4)
Requirement already satisfied: toml>=0.9.4 in ./env/lib/python3.8/site-packages (from black) (0.10.0)
Requirement already satisfied: six in ./env/lib/python3.8/site-packages (from packaging->pytest) (1.14.0)
Requirement already satisfied: pyparsing>=2.0.2 in ./env/lib/python3.8/site-packages (from packaging->pytest) (2.4.7)
Requirement already satisfied: idna<3,>=2.5 in ./env/lib/python3.8/site-packages (from requests>=2.7.9->codecov) (2.9)
Requirement already satisfied: certifi>=2017.4.17 in ./env/lib/python3.8/site-packages (from requests>=2.7.9->codecov) (2020.4.5.1)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in ./env/lib/python3.8/site-packages (from requests>=2.7.9->codecov) (1.25.9)
Requirement already satisfied: chardet<4,>=3.0.2 in ./env/lib/python3.8/site-packages (from requests>=2.7.9->codecov) (3.0.4)
Running black…
/Users/ksera/github/python-slackclient/env/bin/python -m black /Users/ksera/github/python-slackclient/slack
All done! ✨ 🍰 ✨
22 files left unchanged.
Running flake8…
/Users/ksera/github/python-slackclient/env/bin/python -m flake8 /Users/ksera/github/python-slackclient/slack
Running pytest…
/Users/ksera/github/python-slackclient/env/bin/python -m pytest --cov-report=xml --cov=/Users/ksera/github/python-slackclient/slack tests/
========================================================================================= test session starts ==========================================================================================
platform darwin -- Python 3.8.2, pytest-5.4.1, py-1.8.1, pluggy-0.13.1
rootdir: /Users/ksera/github/python-slackclient, inifile: pytest.ini
plugins: cov-2.8.1
collected 220 items                                                                                                                                                                                    

tests/test_asyncio_event_loops.py .s.                                                                                                                                                            [  1%]
tests/rtm/test_rtm_client.py ........                                                                                                                                                            [  5%]
tests/rtm/test_rtm_client_functional.py ..............                                                                                                                                           [ 11%]
tests/signature/test_signature_verifier.py ..........                                                                                                                                            [ 15%]
tests/web/test_slack_response.py .                                                                                                                                                               [ 16%]
tests/web/test_web_client.py ..................                                                                                                                                                  [ 24%]
tests/web/test_web_client_coverage.py .                                                                                                                                                          [ 25%]
tests/web/test_web_client_functional.py ..                                                                                                                                                       [ 25%]
tests/web/classes/test_actions.py ........                                                                                                                                                       [ 29%]
tests/web/classes/test_attachments.py ..........                                                                                                                                                 [ 34%]
tests/web/classes/test_blocks.py .........................                                                                                                                                       [ 45%]
tests/web/classes/test_dialogs.py ............                                                                                                                                                   [ 50%]
tests/web/classes/test_elements.py .......................................                                                                                                                       [ 68%]
tests/web/classes/test_init.py ..                                                                                                                                                                [ 69%]
tests/web/classes/test_objects.py ...........................................                                                                                                                    [ 89%]
tests/web/classes/test_views.py ........................                                                                                                                                         [100%]

=========================================================================================== warnings summary ===========================================================================================
env/lib/python3.8/site-packages/aiohttp-3.6.2-py3.8.egg/aiohttp/helpers.py:107
  /Users/ksera/github/python-slackclient/env/lib/python3.8/site-packages/aiohttp-3.6.2-py3.8.egg/aiohttp/helpers.py:107: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
    def noop(*args, **kwargs):  # type: ignore

tests/rtm/test_rtm_client_functional.py: 19 tests with warnings
tests/web/test_web_client.py: 13 tests with warnings
  /Users/ksera/github/python-slackclient/env/lib/python3.8/site-packages/aiohttp-3.6.2-py3.8.egg/aiohttp/connector.py:964: DeprecationWarning: The loop argument is deprecated since Python 3.8, and scheduled for removal in Python 3.10.
    hosts = await asyncio.shield(self._resolve_host(

tests/rtm/test_rtm_client_functional.py: 19 tests with warnings
tests/web/test_web_client.py: 13 tests with warnings
  /Users/ksera/github/python-slackclient/env/lib/python3.8/site-packages/aiohttp-3.6.2-py3.8.egg/aiohttp/locks.py:21: DeprecationWarning: The loop argument is deprecated since Python 3.8, and scheduled for removal in Python 3.10.
    self._event = asyncio.Event(loop=loop)

tests/rtm/test_rtm_client_functional.py: 10 tests with warnings
  /Users/ksera/github/python-slackclient/env/lib/python3.8/site-packages/aiohttp-3.6.2-py3.8.egg/aiohttp/web_server.py:53: DeprecationWarning: The loop argument is deprecated since Python 3.8, and scheduled for removal in Python 3.10.
    await asyncio.gather(*coros, loop=self._loop)

-- Docs: https://docs.pytest.org/en/latest/warnings.html

---------- coverage: platform darwin, python 3.8.2-final-0 -----------
Coverage XML written to file coverage.xml

============================================================================= 219 passed, 1 skipped, 75 warnings in 10.94s =============================================================================
(env) $ 

@seratch seratch changed the title aiohttp-4.0.0a1-py3.6 - RuntimeWarning: coroutine 'noop' was never awaited aiohttp: RuntimeWarning: coroutine 'noop' was never awaited (4.0.0a1-py3.6 / 3.6.2-py3.8) May 20, 2020
@seratch seratch removed the needs info An issue that is claimed to be a bug and hasn't been reproduced, or otherwise needs more info label May 20, 2020
@seratch
Copy link
Member

seratch commented May 20, 2020

I'm not planning to actively work on this in the short term. If someone finds a solution and shares it with us, it'd be greatly appreciated.

@iairsalem
Copy link

4.0.0.a1, python 3.9

BTW:

  1. @dima-kov , I get "RuntimeWarning: Enable tracemalloc to get the object allocation traceback", does this confirm your point?
  2. helpers.py workaround did not help.
aiohttp/client.py:977: RuntimeWarning: coroutine 'noop' was never awaited
  self._resp.release()
RuntimeWarning: Enable tracemalloc to get the object allocation traceback

This does not fix it:
helpers.py

old_debug = coroutines._DEBUG  # type: ignore

# prevent "coroutine noop was never awaited" warning.
coroutines._DEBUG = False  # type: ignore

async def noop(*args: Any, **kwargs: Any) -> None:
    return

coroutines._DEBUG = old_debug  # type: ignore

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants