Jump to solution
Details

The Fix

pip install urllib3==1.26.7

Based on closed urllib3/urllib3 issue #2326 · 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,25 @@ @@ -0,0 +1,25 @@ +name: Downstream + +on: [push, pull_request]
fix.md
Option A — Upgrade to fixed release\npip install urllib3==1.26.7\nWhen NOT to use: Do not use this fix if maxsize is not intended to be 0.\n\n

Why This Fix Works in Production

  • Trigger: Fix `RecentlyUsedContainer` regression
  • Mechanism: The regression in RecentlyUsedContainer's __setitem__ method caused exceptions when maxsize is set to 0
  • Why the fix works: Fixes a regression in the RecentlyUsedContainer's __setitem__ method when maxsize is set to 0, ensuring that the container behaves correctly without raising exceptions. (first fixed release: 1.26.7).
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

  • The regression in RecentlyUsedContainer's __setitem__ method caused exceptions when maxsize is set to 0
  • Production symptom (often without a traceback): Fix `RecentlyUsedContainer` regression

Proof / Evidence

  • GitHub issue: #2326
  • Fix PR: https://github.com/urllib3/urllib3/pull/2316
  • First fixed release: 1.26.7
  • 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.77

Discussion

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

“@SethMichaelLarson ah good point; I misunderstood. That approach looks sound to me.”
@haikuginger · 2021-07-12 · source
“@pquentin thanks for opening this! The new logic is generally easier to reason about when it comes to typing, so I'd prefer to stick with…”
@haikuginger · 2021-07-12 · source
“@haikuginger That won't work as a fix, if RecentlyUsedContainer is given maxsize=0 then there shouldn't be an object in the container after calling __setitem__.”
@sethmlarson · 2021-07-12 · source
“My proposal is this: Passes all of our existing tests and adds a new one for an empty RecentlyUsedContainer”
@sethmlarson · 2021-07-12 · source

Failure Signature (Search String)

  • Fix `RecentlyUsedContainer` regression
  • When `len(self._container)` == `self._maxsize` == 0, `self._container[key] = value` is now called *after* `self._container.popitem(last=False)`, which is why that `popitem` call
Copy-friendly signature
signature.txt
Failure Signature ----------------- Fix `RecentlyUsedContainer` regression When `len(self._container)` == `self._maxsize` == 0, `self._container[key] = value` is now called *after* `self._container.popitem(last=False)`, which is why that `popitem` call raises an exception.

Error Message

Signature-only (no traceback captured)
error.txt
Error Message ------------- Fix `RecentlyUsedContainer` regression When `len(self._container)` == `self._maxsize` == 0, `self._container[key] = value` is now called *after* `self._container.popitem(last=False)`, which is why that `popitem` call raises an exception.

What Broke

Tests fail due to exceptions raised when adding items to an empty RecentlyUsedContainer.

Why It Broke

The regression in RecentlyUsedContainer's __setitem__ method caused exceptions when maxsize is set to 0

Fix Options (Details)

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

pip install urllib3==1.26.7

When NOT to use: Do not use this fix if maxsize is not intended to be 0.

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

Fix reference: https://github.com/urllib3/urllib3/pull/2316

First fixed release: 1.26.7

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 use this fix if maxsize is not intended to be 0.

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.

Version Compatibility Table

VersionStatus
1.26.7 Fixed

Related Issues

No related fixes found.

Sources

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