Jump to solution
Verify

The Fix

pip install urllib3==1.25.11

Based on closed urllib3/urllib3 issue #1934 · PR/commit linked

Production note: Watch p95/p99 latency and retry volume; timeouts can turn into retry storms and duplicate side-effects.

Jump to Verify Open PR/Commit
@@ -15,3 +15,5 @@ gcp-devrel-py-tools==0.0.15 # https://github.com/GoogleCloudPlatform/python-repo-tools/issues/23 pylint<2.0;python_version<="2.7" + +python-dateutil==2.8.1 diff --git a/src/urllib3/util/retry.py b/src/urllib3/util/retry.py
repro
test/test_retry.py::TestRetry::test_respect_retry_after_header_sleep[Mon Jun 3 11:30:12 2019-True-1812]
verify
Follow the reproduction steps, confirm the failure, apply the fix, and repeat the same steps to verify the behavior changes.
fix.md
Option A — Upgrade to fixed release\npip install urllib3==1.25.11\nWhen NOT to use: This fix is not applicable if the application relies on local timezone handling.\n\n

Why This Fix Works in Production

  • Trigger: Incorrect handling of Retry-After (2.7)
  • Mechanism: Addresses the incorrect handling of the Retry-After header in Python 2.7 by assuming UTC timezone if none is specified.
  • Why the fix works: Addresses the incorrect handling of the Retry-After header in Python 2.7 by assuming UTC timezone if none is specified. (first fixed release: 1.25.11).
Production impact:
  • If left unfixed, this can cause silent data inconsistencies that propagate (bad cache entries, incorrect downstream decisions).

Why This Breaks in Prod

  • Shows up under Python 2.7 in real deployments (not just unit tests).
  • Production symptom (often without a traceback): Incorrect handling of Retry-After (2.7)

Proof / Evidence

  • GitHub issue: #1934
  • Fix PR: https://github.com/urllib3/urllib3/pull/1935
  • First fixed release: 1.25.11
  • Reproduced locally: No (not executed)
  • Last verified: 2026-02-09
  • Confidence: 0.95
  • Did this fix it?: Yes (upstream fix exists)
  • Own content ratio: 0.70

Discussion

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

“Huh, wasn't seeing Python 2.7 failures on macOS. How'd you catch this issue?”
@sethmlarson · 2020-08-25 · source
“I ran it on my Linux VM which has a weird timezone set. It seems our CI (at least actions and travis) runs on UTC.”
@hodbn · 2020-08-25 · source
“Ahhh makes sense, glad you caught this! :)”
@sethmlarson · 2020-08-25 · source

Failure Signature (Search String)

  • Incorrect handling of Retry-After (2.7)
  • Since `email.utils.mktime_tz` assumes a ```None``` timezone to be the local timezone, the resulting date might be wrong when calculating `Retry-After` timeout of a value without a
Copy-friendly signature
signature.txt
Failure Signature ----------------- Incorrect handling of Retry-After (2.7) Since `email.utils.mktime_tz` assumes a ```None``` timezone to be the local timezone, the resulting date might be wrong when calculating `Retry-After` timeout of a value without a timezone.

Error Message

Signature-only (no traceback captured)
error.txt
Error Message ------------- Incorrect handling of Retry-After (2.7) Since `email.utils.mktime_tz` assumes a ```None``` timezone to be the local timezone, the resulting date might be wrong when calculating `Retry-After` timeout of a value without a timezone.

Minimal Reproduction

  1. test/test_retry.py::TestRetry::test_respect_retry_after_header_sleep[Mon Jun 3 11:30:12 2019-True-1812]

Environment

  • Python: 2.7

What Broke

Incorrect date calculations for `Retry-After` headers leading to potential request failures.

Fix Options (Details)

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

pip install urllib3==1.25.11

When NOT to use: This fix is not applicable if the application relies on local timezone handling.

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.
  • This does NOT fix data corruption; it only prevents duplicate side-effects.
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/urllib3/urllib3/pull/1935

First fixed release: 1.25.11

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 is not applicable if the application relies on local timezone handling.
  • 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
Follow the reproduction steps, confirm the failure, apply the fix, and repeat the same steps to verify the behavior changes.

Did This Fix Work in Your Case?

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

Prevention

  • Add a CI check that diffs key outputs after upgrades (OpenAPI schema snapshots, JSON payload shapes, CLI output).
  • Upgrade behind a canary and run integration tests against the canary before 100% rollout.
  • Make timeouts explicit and test them (unit + integration) to avoid silent behavior changes.
  • Instrument retries (attempt count + reason) and alert on spikes to catch dependency slowdowns.

Version Compatibility Table

VersionStatus
1.25.11 Fixed

Related Issues

No related fixes found.

Sources

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