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
httpcore_async\http_proxy.py line206 - line244
If any exception(like ReadTimeout) raise between socket establishing and adding connection to pool, connection will leak.
I set read timeout to 1s, connect timeout to 15s.
code here:
import os
os.environ["HTTPX_LOG_LEVEL"] = "TRACE"
import asyncio
import httpx
from httpx._config import Timeout
async def run():
try:
async with httpx.AsyncClient(proxies="some proxy address") as client:
r = await client.get('https://www.baidu.com/', timeout=Timeout(5, connect=15, read=1))
await asyncio.sleep(40)
rasie
except Exception as exc:
print(type(exc))
await asyncio.sleep(40)
if __name__ == '__main__':
loop = asyncio.get_event_loop()
loop.run_until_complete(run())
log here:
after AsyncClient is closed, socket is still there.
conclusion:
Even if AsyncClient.aexit has executed, but socket remain ESTABLISHED, because exception raise before calling
AsyncConnectionPool._add_to_pool, AsyncConnectionPool._connections is empty.
The text was updated successfully, but these errors were encountered:
python 3.6.9
httpx 0.16.0
httpcore 0.12.0
httpcore_async\http_proxy.py line206 - line244
If any exception(like ReadTimeout) raise between socket establishing and adding connection to pool, connection will leak.
I set read timeout to 1s, connect timeout to 15s.
code here:
log here:
after AsyncClient is closed, socket is still there.
conclusion:
Even if AsyncClient.aexit has executed, but socket remain ESTABLISHED, because exception raise before calling
AsyncConnectionPool._add_to_pool, AsyncConnectionPool._connections is empty.
The text was updated successfully, but these errors were encountered: