From 142b5ecefc03f23e6a9e7c06057ee91c7225f2e9 Mon Sep 17 00:00:00 2001 From: Sendao Yan Date: Thu, 5 Nov 2026 22:09:26 +0800 Subject: [PATCH] Fix bm_fastapi benchmark failing when an HTTP proxy is configured httpx.AsyncClient() reads HTTP_PROXY/HTTPS_PROXY/NO_PROXY from the environment by default. When a proxy is set, the benchmark routes requests to its local 127.0.0.1 server through that proxy, which cannot reach the loopback server and returns 503 Service Unavailable, causing the benchmark to fail ("Benchmark died"). Pass trust_env=False since the benchmark only ever talks to localhost. --- pyperformance/data-files/benchmarks/bm_fastapi/run_benchmark.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyperformance/data-files/benchmarks/bm_fastapi/run_benchmark.py b/pyperformance/data-files/benchmarks/bm_fastapi/run_benchmark.py index 3e440325..09c7dc2c 100644 --- a/pyperformance/data-files/benchmarks/bm_fastapi/run_benchmark.py +++ b/pyperformance/data-files/benchmarks/bm_fastapi/run_benchmark.py @@ -63,7 +63,7 @@ def setup_server(): def bench_fastapi(loops, url): async def run_benchmark(): - async with httpx.AsyncClient() as client: + async with httpx.AsyncClient(trust_env=False) as client: t0 = pyperf.perf_counter() for i in range(loops):