AsyncQdrantClient hangs with httpx.ReadTimeout when trust_env=True, while the same request succeeds with trust_env=False
I encountered an issue with AsyncQdrantClient using the REST API.
A vector search against a local Qdrant instance (127.0.0.1:6333) consistently hangs until httpx.ReadTimeout when using the default httpx environment handling.
The same Qdrant search works immediately when using httpx.AsyncClient(trust_env=False).
The Qdrant server itself appears healthy, and the exact same vector search succeeds through raw HTTP, urllib, synchronous httpx, and asynchronous httpx with trust_env=False.
There are no obvious proxy variables in the shell environment: env | grep -i proxy returns nothing.
This may indicate that the request is affected by some environment/system-level networking configuration that httpx detects when trust_env=True.
In addition, get_collections() and scrolling() via AsyncQdrantClient work fine. Apparently, only vector search queries are affected.
I'm not very familiar with the internals of httpx or qdrant-client, so I may be missing something obvious here. I would appreciate any guidance on what might be causing this behavior or what additional information would be useful for debugging it.
File "/.venv/lib/python3.12/site-packages/qdrant_client/async_qdrant_client.py", line 341, in search
return await self._client.search(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/.venv/lib/python3.12/site-packages/qdrant_client/async_qdrant_remote.py", line 408, in search
search_result = await self.http.points_api.search_points(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/.venv/lib/python3.12/site-packages/qdrant_client/http/api/points_api.py", line 1363, in search_points
return await self._build_for_search_points(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/.venv/lib/python3.12/site-packages/qdrant_client/http/api_client.py", line 151, in request
return await self.send(request, type_)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/.venv/lib/python3.12/site-packages/qdrant_client/http/api_client.py", line 168, in send
response = await self.middleware(request, self.send_inner)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/.venv/lib/python3.12/site-packages/qdrant_client/http/api_client.py", line 200, in __call__
return await call_next(request)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/.venv/lib/python3.12/site-packages/qdrant_client/http/api_client.py", line 180, in send_inner
raise ResponseHandlingException(e)
qdrant_client.http.exceptions.ResponseHandlingException
I tried to reproduce this on qdrant-client 1.16.1 / httpx 0.28.1 / Windows 10, against a local Docker Qdrant server (v1.19.0). get_collections(), scroll(), and query_points() (the current equivalent of search()) all completed instantly (<0.1s) with default settings (trust_env=True). No hang occurred.
@kirden31 , could you share:
- Your OS
- Your exact
qdrant-clientandhttpxversions (pip show qdrant-client httpx) - Whether you're behind a VPN or corporate proxy when this happens
That would help determine whether this is a proxy-detection issue specific to certain network or version combinations rather than a qdrant-client bug.
OS: Ubuntu 24.04.4 live server
qdrant-client 1.12.2 httpx 0.28.1
I'm using iptables to redirect traffic to XRAY, but 127.0.0.1 it doesn't touch and routes it to RETURN. However, this may be due to a delay
Chain XRAY (1 references)
num pkts bytes target prot opt in out source destination
1 18590 3324K RETURN 0 -- * * 0.0.0.0/0 127.0.0.0/8
2 3803 3104K RETURN 0 -- * * 0.0.0.0/0 10.0.0.0/8
3 0 0 RETURN 0 -- * * 0.0.0.0/0 100.64.0.0/10
4 0 0 RETURN 0 -- * * 0.0.0.0/0 169.254.0.0/16
5 519 85574 RETURN 0 -- * * 0.0.0.0/0 172.16.0.0/12
6 16424 7069K RETURN 0 -- * * 0.0.0.0/0 192.168.0.0/16
7 0 0 RETURN 0 -- * * 0.0.0.0/0 224.0.0.0/4
8 0 0 RETURN 0 -- * * 0.0.0.0/0 240.0.0.0/4
9 1248 227K TPROXY 6 -- * * 0.0.0.0/0 0.0.0.0/0 TPROXY redirect 0.0.0.0:12345 mark 0x1/0xffffffff
10 28 2128 TPROXY 17 -- * * 0.0.0.0/0 0.0.0.0/0 TPROXY redirect 0.0.0.0:12345 mark 0x1/0xffffffff
Thanks, this clarifies two important differences from my reproduction: you are on qdrant-client 1.12.2, and the failing call uses the legacy search() endpoint, whereas I tested query_points() on 1.16.1. Those are different request paths.
Since 127.0.0.1 is explicitly excluded by your XRAY rules and you already confirmed there are no proxy environment variables, it would help to see where the failing process actually connects:
strace -f -e trace=connect -s 200 python scriptName.py
If the failing run connects only to 127.0.0.1:6333, that points away from proxy redirection and toward a request-path or client-version issue. If it connects to another address or port, that would explain why XRAY is involved despite the loopback exemption.
If possible could you also check whether upgrading qdrant-client and replacing search() with query_points() eliminates the timeout? That would help determine whether this is specific to the legacy client path.
After updating the library, the problem went away.. Always update...