Jump to solution
Verify

The Fix

Upgrade to version 0.17.6 or later.

Based on closed Kludex/uvicorn issue #1281 · PR/commit linked

Jump to Verify Open PR/Commit
@@ -1,3 +1,4 @@ @@ -1,3 +1,4 @@ +import socket from logging import WARNING
repro.py
@pytest.mark.asyncio @pytest.mark.parametrize( "host, url", [ pytest.param(None, "http://127.0.0.1:8000", id="default"), pytest.param("localhost", "http://127.0.0.1:8000", id="hostname"), pytest.param("::1", "http://[::1]:8000", id="ipv6"), ], ) async def test_run(host, url): config = Config(app=app, host=host, loop="asyncio", limit_max_requests=1) async with run_server(config): async with httpx.AsyncClient() as client: response = await client.get(url)
verify
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.
fix.md
Option A — Upgrade to fixed release\nUpgrade to version 0.17.6 or later.\nWhen NOT to use: Do not apply this fix if the system is expected to support IPv6.\n\n

Why This Fix Works in Production

  • Trigger: tests/test_ssl.py …
  • Mechanism: The test fails on systems without an IPv6 network stack due to lack of handling for this case
  • Why the fix works: Skip the test if no IPv6 is detected on the system, addressing failures in the test suite. (first fixed release: 0.17.6).

Why This Breaks in Prod

  • Shows up under Python 3.8 in real deployments (not just unit tests).
  • The test fails on systems without an IPv6 network stack due to lack of handling for this case
  • Production symptom (often without a traceback): tests/test_ssl.py .... [ 73%]

Proof / Evidence

  • GitHub issue: #1281
  • Fix PR: https://github.com/kludex/uvicorn/pull/1383
  • First fixed release: 0.17.6
  • Reproduced locally: No (not executed)
  • Last verified: 2026-02-09
  • Confidence: 0.85
  • Did this fix it?: Yes (upstream fix exists)
  • Own content ratio: 0.62

Discussion

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

“Hi @kloczek, I'm new in the open-source world and I want to work on this issue if everyone is ok with this. cc. @euri10”
@yosoycentli · 2021-12-21 · source
“yes, kind of expected, I remember urllib has something in its test suite to handle that case, a PR for this would be easily accepted,…”
@euri10 · 2021-12-06 · source
“just for fun, linking https://github.com/encode/uvicorn/issues/1245 yes there are systems without ipv6 !”
@euri10 · 2021-12-06 · source
“Hi @kloczek , I was trying to recreate the error but I have problems with that, can you help me with this?”
@yosoycentli · 2021-12-23 · source

Failure Signature (Search String)

  • tests/test_ssl.py .... [ 73%]
  • ================================================================================= FAILURES =================================================================================
Copy-friendly signature
signature.txt
Failure Signature ----------------- tests/test_ssl.py .... [ 73%] ================================================================================= FAILURES =================================================================================

Error Message

Signature-only (no traceback captured)
error.txt
Error Message ------------- tests/test_ssl.py .... [ 73%] ================================================================================= FAILURES =================================================================================

Minimal Reproduction

repro.py
@pytest.mark.asyncio @pytest.mark.parametrize( "host, url", [ pytest.param(None, "http://127.0.0.1:8000", id="default"), pytest.param("localhost", "http://127.0.0.1:8000", id="hostname"), pytest.param("::1", "http://[::1]:8000", id="ipv6"), ], ) async def test_run(host, url): config = Config(app=app, host=host, loop="asyncio", limit_max_requests=1) async with run_server(config): async with httpx.AsyncClient() as client: response = await client.get(url)

Environment

  • Python: 3.8

What Broke

Test suite failures lead to unreliable test results and potential CI/CD pipeline issues.

Why It Broke

The test fails on systems without an IPv6 network stack due to lack of handling for this case

Fix Options (Details)

Option A — Upgrade to fixed release Safe default (recommended)

Upgrade to version 0.17.6 or later.

When NOT to use: Do not apply this fix if the system is expected to support IPv6.

Use when you can deploy the upstream fix. It is usually lower-risk than long-lived workarounds.

Option D — Guard side-effects with OnceOnly Guardrail for side-effects

Mitigate duplicate external side-effects under retries/timeouts/agent loops by gating the operation before calling external systems.

  • Place OnceOnly between your code/agent and real side-effects (Stripe, emails, CRM, APIs).
  • Use a stable key per side-effect (e.g., customer_id + action + idempotency_key).
  • Fail-safe: configure fail-open vs fail-closed based on blast radius and spend risk.
Show example snippet (optional)
onceonly.py
from onceonly import OnceOnly import os once = OnceOnly(api_key=os.environ["ONCEONLY_API_KEY"], fail_open=True) # Stable idempotency key per real side-effect. # Use a request id / job id / webhook delivery id / Stripe event id, etc. event_id = "evt_..." # replace key = f"stripe:webhook:{event_id}" res = once.check_lock(key=key, ttl=3600) if res.duplicate: return {"status": "already_processed"} # Safe to execute the side-effect exactly once. handle_event(event_id)

See OnceOnly SDK

When NOT to use: Do not use this to hide logic bugs or data corruption. Use it to block duplicate external side-effects and enforce tool permissions/spend caps.

Fix reference: https://github.com/kludex/uvicorn/pull/1383

First fixed release: 0.17.6

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

  • Do not apply this fix if the system is expected to support IPv6.
  • Do not use this to hide logic bugs or data corruption. Use it to block duplicate external side-effects and enforce tool permissions/spend caps.

Verify Fix

verify
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.

Did This Fix Work in Your Case?

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

Prevention

  • Add a TLS smoke test that performs a real handshake in CI (include CA bundle validation and hostname checks).
  • Alert on handshake failures by error string and endpoint to catch cert/CA changes quickly.
  • Track RSS + object counts after deployments; alert on monotonic growth and GC pressure.
  • Add a long-running test that repeats the failing call path and asserts stable memory.

Version Compatibility Table

VersionStatus
0.17.6 Fixed

Related Issues

No related fixes found.

Sources

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