Jump to solution
Details

The Fix

Fixes blocking I/O in the event loop when netrc authentication is used by moving netrc file lookup to an executor.

Based on closed aio-libs/aiohttp issue #10435 · PR/commit linked

Production note: Most teams hit this during upgrades or environment changes. Roll out with a canary and smoke critical endpoints (health, OpenAPI/docs) before 100%.

Open PR/Commit
@@ -0,0 +1 @@ @@ -0,0 +1 @@ +Fixed blocking I/O in the event loop when using netrc authentication by moving netrc file lookup to an executor -- by :user:`bdraco`. diff --git a/aiohttp/client.py b/aiohttp/client.py index a7da3ff0c57..7a4ad715362 100644
fix.md
Option A — Apply the official fix\nFixes blocking I/O in the event loop when netrc authentication is used by moving netrc file lookup to an executor.\nWhen NOT to use: This fix should not be used if synchronous netrc file access is required.\n\n

Why This Fix Works in Production

  • Trigger: ```python-traceback
  • Mechanism: Fixes blocking I/O in the event loop when netrc authentication is used by moving netrc file lookup to an executor.
Production impact:
  • If left unfixed, the same config can fail only in production (env differences), causing startup failures or partial feature outages.

Why This Breaks in Prod

  • Production symptom (often without a traceback): ```python-traceback

Proof / Evidence

Discussion

High-signal excerpts from the issue thread (symptoms, repros, edge-cases).

“Caching the result of netrc_from_env (eg with @functools.cache) could be a first step to minimize the impact”
@cbornet · 2025-02-08 · source
“We can potentially put a proper fix into v4 and mitigations into v3, if necessary.”
@Dreamsorcerer · 2025-02-08 · source
“How long is the call blocks? Do you have numbers? I expect that the filesystem cache works pretty well in this case.”
@asvetlov · 2025-02-08 · source
“I don't have numbers for how long it blocks”
@cbornet · 2025-02-10 · source

Failure Signature (Search String)

  • ```python-traceback
  • I understand the tradeoff between making a breaking change and doing a small optimization.
Copy-friendly signature
signature.txt
Failure Signature ----------------- ```python-traceback I understand the tradeoff between making a breaking change and doing a small optimization.

Error Message

Signature-only (no traceback captured)
error.txt
Error Message ------------- ```python-traceback I understand the tradeoff between making a breaking change and doing a small optimization.

What Broke

Instantiating ClientRequest blocks the asyncio event loop, causing delays in request handling.

Fix Options (Details)

Option A — Apply the official fix

Fixes blocking I/O in the event loop when netrc authentication is used by moving netrc file lookup to an executor.

When NOT to use: This fix should not be used if synchronous netrc file access is required.

Fix reference: https://github.com/aio-libs/aiohttp/pull/11634

Last verified: 2026-02-09. Validate in your environment.

Get updates

We publish verified fixes weekly. No spam.

Subscribe

When NOT to Use This Fix

  • This fix should not be used if synchronous netrc file access is required.

Did This Fix Work in Your Case?

Quick signal helps us prioritize which fixes to verify and improve.

Prevention

  • Add a stress test that runs high-concurrency workloads and fails on thread dumps / blocked locks.
  • Enable watchdog dumps in prod (faulthandler, thread dump endpoint) to capture deadlocks quickly.

Related Issues

No related fixes found.

Sources

We don’t republish the full GitHub discussion text. Use the links above for context.