You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Random KeyErrors when performing GET requests (possible race condition) #581
When performing a get request using httpx.client.get, I am (with every 1/10 requests or so) getting random key errors. The only argument being handed to this call is a 5 second timeout, a google "NID" cookie, and the URL. I've attached a text file with the error. KeyError.txt
What's the simplest possible example that reproduces this reliably?
Is this only occuring against a specific URL, or can you determine various cases where its failing?
I've only tried it against the Google Trends API (https://trends.google.com/trends/api/*). The simplest way to reproduce the error would be to pull https://github.com/KyleKreutzer/pytrends-async and run the unit tests using pytest w/pytest-asyncio. The problem is occurring intermittently so it may take more than 1 run to have the issue appear, but any of those tests seem to reliably reproduce the problem.
Edit:
I noticed that I did not have my Client objects wrapped with async with. I tried adding this, and it has not fixed the issue.
for i in range(100):
async with httpx.Client() as c:
resp = await c.get('https://trends.google.com/?geo={geo}'.format(geo='US'), timeout=5)
time.sleep(1)
I was able to reproduce it again with above code snippet on both mac and windows using 3.7.0 and 3.7.3. I am not using trio and am using version httpx==0.8.0 from pypi.
Activity
lovelydinosaur commentedon Dec 2, 2019
Thanks for reporting this.
What's the simplest possible example that reproduces this reliably?
Is this only occuring against a specific URL, or can you determine various cases where its failing?
KyleKreutzer commentedon Dec 2, 2019
I've only tried it against the Google Trends API (https://trends.google.com/trends/api/*). The simplest way to reproduce the error would be to pull https://github.com/KyleKreutzer/pytrends-async and run the unit tests using pytest w/pytest-asyncio. The problem is occurring intermittently so it may take more than 1 run to have the issue appear, but any of those tests seem to reliably reproduce the problem.
Edit:
I noticed that I did not have my Client objects wrapped with
async with. I tried adding this, and it has not fixed the issue.KyleKreutzer commentedon Dec 2, 2019
This will reproduce the bug
millefalcon commentedon Dec 6, 2019
Is this still reproducible ?
Couldn't reproduce it with:
KyleKreutzer commentedon Dec 6, 2019
I was able to reproduce it again with above code snippet on both mac and windows using 3.7.0 and 3.7.3. I am not using trio and am using version httpx==0.8.0 from pypi.
lovelydinosaur commentedon Dec 8, 2019
Closed in master via #612