Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

chore(deps): require anyio>=4.14.0 to rule out the lock-waiter deadlock (#47378)

yucheng-berri2e427c624790
diff --git a/packaging/litellm-core/pyproject.toml b/packaging/litellm-core/pyproject.toml
index cf87cc6b936..2add6868bd9 100644
--- a/packaging/litellm-core/pyproject.toml
+++ b/packaging/litellm-core/pyproject.toml
@@ -24,6 +24,7 @@ dependencies = [
"click>=8.0.0,<9.0",
"jinja2>=3.1.6,<4.0",
"aiohttp>=3.14.2,<4.0",
+ "anyio>=4.14.0,<5.0",
"async-timeout>=4.0.3,<6.0; python_version < '3.11'",
"pydantic>=2.11.0,<3.0.0; python_version < '3.14'",
"pydantic>=2.12.0,<3.0.0; python_version >= '3.14'",
diff --git a/pyproject.toml b/pyproject.toml
index f6697a1b57a..6c71140e6b8 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -29,6 +29,7 @@ dependencies = [
"click>=8.0.0,<9.0",
"jinja2>=3.1.6,<4.0",
"aiohttp>=3.14.2,<4.0",
+ "anyio>=4.14.0,<5.0",
"async-timeout>=4.0.3,<6.0; python_version < '3.11'",
"pydantic>=2.11.0,<3.0.0; python_version < '3.14'",
"pydantic>=2.12.0,<3.0.0; python_version >= '3.14'",
diff --git a/tests/unit/test_package_metadata.py b/tests/unit/test_package_metadata.py
index fb6069291d8..dc6e3dca64e 100644
--- a/tests/unit/test_package_metadata.py
+++ b/tests/unit/test_package_metadata.py
@@ -5,6 +5,7 @@ from typing import Final
from packaging.requirements import Requirement
from packaging.specifiers import SpecifierSet
from packaging.utils import NormalizedName, canonicalize_name
+from packaging.version import Version
if sys.version_info >= (3, 11):
import tomllib
@@ -18,6 +19,8 @@ OPTIONAL_DEPENDENCIES: Final = PYPROJECT["project"]["optional-dependencies"]
AIOHTTP_POOL_POISONING_RANGE: Final = SpecifierSet(">=3.14.0,<3.14.2")
AIOHTTP_POOL_POISONING_RELEASES: Final = ("3.14.0", "3.14.1")
AIOHTTP_POOL_POISONING_SOURCE: Final = "aio-libs/aiohttp#12953, fixed in aiohttp 3.14.2"
+ANYIO_STRANDED_LOCK_WAITER_FIX: Final = Version("4.14.0")
+ANYIO_STRANDED_LOCK_WAITER_SOURCE: Final = "agronholm/anyio#1145, fixed in anyio 4.14.0 released 2026-06-15"
CLI_RUNTIME_DEPENDENCIES: Final = frozenset({"rich", "pyyaml", "requests"})
PROXY_SERVER_ONLY_DEPENDENCIES: Final = frozenset(
{
@@ -92,3 +95,17 @@ def test_locked_aiohttp_version_is_not_pool_poisoning() -> None:
locked: Final = _locked_package("aiohttp")["version"]
assert isinstance(locked, str)
assert not AIOHTTP_POOL_POISONING_RANGE.contains(locked), AIOHTTP_POOL_POISONING_SOURCE
+
+
+def test_declared_anyio_floor_is_at_or_above_stranded_lock_waiter_fix() -> None:
+ declared: Final = tuple(
+ Requirement(requirement)
+ for requirement in PYPROJECT["project"]["dependencies"]
+ if canonicalize_name(Requirement(requirement).name) == "anyio"
+ )
+ assert len(declared) == 1, ANYIO_STRANDED_LOCK_WAITER_SOURCE
+ assert declared[0].marker is None, ANYIO_STRANDED_LOCK_WAITER_SOURCE
+ assert any(
+ specifier.operator == ">=" and Version(specifier.version) >= ANYIO_STRANDED_LOCK_WAITER_FIX
+ for specifier in declared[0].specifier
+ ), ANYIO_STRANDED_LOCK_WAITER_SOURCE
diff --git a/uv.lock b/uv.lock
index beb66fe42b2..69d9f777687 100644
--- a/uv.lock
+++ b/uv.lock
@@ -4508,6 +4508,7 @@ version = "1.107.0"
source = { editable = "." }
dependencies = [
{ name = "aiohttp" },
+ { name = "anyio" },
{ name = "async-timeout", marker = "python_full_version < '3.11'" },
{ name = "boto3" },
{ name = "click" },
@@ -4761,6 +4762,7 @@ requires-dist = [
{ name = "a2a-sdk", marker = "extra == 'extra-proxy'", specifier = ">=1.1.0,<2.0" },
{ name = "aiohttp", specifier = ">=3.14.2,<4.0" },
{ name = "anthropic", extras = ["vertex"], marker = "extra == 'proxy-runtime'", specifier = ">=0.84.0,<1.0" },
+ { name = "anyio", specifier = ">=4.14.0,<5.0" },
{ name = "apscheduler", marker = "extra == 'proxy'", specifier = ">=3.11.2,<4.0" },
{ name = "async-timeout", marker = "python_full_version < '3.11'", specifier = ">=4.0.3,<6.0" },
{ name = "audioread", marker = "extra == 'stt-nvidia-riva'", specifier = ">=3.0.1" },