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

Event loop gets stuck awaiting the request after last change or requests-async/http3 #93

Closed
gvbgduh opened this issue Jun 18, 2019 · 2 comments

Comments

@gvbgduh
Copy link
Member

gvbgduh commented Jun 18, 2019

I've discovered an interesting behaviour recently.
The matter is that the code below starts getting stuck at awaiting the request since the bump of request-async to 0.5.0 (0.4.1 works well), but the only meaningful change in encode/requests-async#48 is bumping of httpcore/http3 to 0.3.0 (if I'm not mistaken). That's why I decided to open an issue here.

I'm wondering if it could be possible to clarify if I'm missing something.
Happy to provide any assistance with investigation/debugging/fixing.

The code example:

import asyncio
import uvloop
import requests_async

myurls = [
    "https://google.com",
    "https://google.com",
]

async def async_get(url):
    resp = await requests_async.get(url)
    return resp.status_code

async def gather_run():
    tasks = [async_get(x) for x in myurls]
    # Await a coroutine
    result_1 = await tasks[0]
    # Or gather them all
    results = await asyncio.gather(*tasks, return_exceptions=True)
    print(f'Results: {results}')
    return results

uvloop.install()
asyncio.run(gather_run())

Note: it behaves same without uvloop.

@tomchristie
Copy link
Member

Gotcha - that was an HTTP/2 issue in an older version.
I've updated requests-async to depend on the http3 now, which appears to resolve the issue.

Sometime soon I'll start recommending just to use http3.AsyncClient() rather than the requests-async wrapper.

@gvbgduh
Copy link
Member Author

gvbgduh commented Jun 19, 2019

Awesome! Thanks a lot for fast update and it's good to know.

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

No branches or pull requests

2 participants