Blocking IO in AsyncClient init #3456
Unanswered
cbornet
asked this question in
Potential Issue
Replies: 1 comment
-
Also seeing it: ...
async with MyClient(base_url) as client:
self.client = httpx.AsyncClient()
/usr/local/lib/python3.12/site-packages/httpx/_client.py:1442: in __init__
self._transport = self._init_transport(
/usr/local/lib/python3.12/site-packages/httpx/_client.py:1490: in _init_transport
return AsyncHTTPTransport(
/usr/local/lib/python3.12/site-packages/httpx/_transports/default.py:280: in __init__
ssl_context = create_ssl_context(verify=verify, cert=cert, trust_env=trust_env)
/usr/local/lib/python3.12/site-packages/httpx/_config.py:55: in create_ssl_context
return SSLConfig(
/usr/local/lib/python3.12/site-packages/httpx/_config.py:79: in __init__
self.ssl_context = self.load_ssl_context()
/usr/local/lib/python3.12/site-packages/httpx/_config.py:91: in load_ssl_context
return self.load_ssl_context_verify()
/usr/local/lib/python3.12/site-packages/httpx/_config.py:146: in load_ssl_context_verify
if ca_bundle_path.is_file():
/usr/local/lib/python3.12/pathlib.py:892: in is_file
return S_ISREG(self.stat().st_mode)
/usr/local/lib/python3.12/pathlib.py:840: in stat
return os.stat(self, follow_symlinks=follow_symlinks) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
It seems to me that some blocking IO calls are done in
AsyncHTTPTransport
init that callscreate_ssl_context
:ssl.load_cert_chain
os.stat
(through various calls to Path.exists(), Path.isfile(), Path.isdir(), ...)So instantiating an
AsyncClient
blocks the event loop which is bad.Beta Was this translation helpful? Give feedback.
All reactions