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
I have a threading Web spider that is triggering a race condition in anyio/_core/_eventloop.py's get_asynclib() function. This race can be triggered if you have a lot of threads trying to initialize their own asyncio event loop and initializing httpx all at once. It happens intermittently -- sometimes we don't trigger the race, sometimes we do. When we do, the threads catch get_asynclib() mid-initialization and certain attributes that should be present are not available. I am using httpx 0.22.0 and python3.7.
httpx. I also have a fix that's required for httpx 0.22.0 that I
reported upstream at encode/httpx#2116 .
This patch fixes an intermittent traceback that can happen.
I have a threading Web spider that is triggering a race condition in anyio/_core/_eventloop.py's get_asynclib() function. This race can be triggered if you have a lot of threads trying to initialize their own asyncio event loop and initializing httpx all at once. It happens intermittently -- sometimes we don't trigger the race, sometimes we do. When we do, the threads catch get_asynclib() mid-initialization and certain attributes that should be present are not available. I am using httpx 0.22.0 and python3.7.
httpx-exception.txt
An ugly but functioning patch which I can confirm resolves the issue is below:
get_asynclib_thread_fix.patch.txt
In my test patch, I made the lock cover essentially the entire get_asynclib() call -- it could potentially be made tighter -- not sure.
Thanks for creating httpx -- it's very nice! :)
The text was updated successfully, but these errors were encountered: