Skip to content

Some text is shown in its original language while the English translation is being prepared.

EventPast event

Pydantic AI fixes concurrency limiter slot leak

2 reports2 reporting sourcesLatest report

Start here

AI overview

Pydantic AI's ConcurrencyLimitedModel and limit_model_concurrency have a concurrency slot leak issue: streaming requests may release a slot on a different task than the one that acquired it, and be rejected by anyio.CapacityLimiter, causing the slot to remain occupied after the request ends. This can be triggered when the stream ends early or when stream_text() is fully consumed with the default debounce_by=0.1. The impact is amplified if the affected streaming interface is exposed and a long-lived limiter is shared across requests. Pydantic AI fixed this high-severity security issue in v2.53.0 (GHSA-6fqq-452j-qhrp), covering scenarios where consumers stop iterating early, raise errors, or are cancelled, as well as fully consuming stream_text() with default debouncing.

Generated by AI from reports · Updated 3 days ago

Progress timeline

Oct 10
  1. Pydantic AI
    Pydantic AI v2.53.0 修复 ConcurrencyLimitedModel 并发槽位泄漏漏洞

    Pydantic AI 在 v2.53.0 中修复了 ConcurrencyLimitedModel 的一个高危安全问题(GHSA-6fqq-452j-qhrp):通过 ConcurrencyLimitedModel 或 limit_model_concurrency 发起的流式请求,可能在槽位由不同任务释放时仍占用并发槽,包括消费者提前停止迭代、抛错或被取消之后,以及用默认 debouncing 完整消费 stream_text() 之后;反复发起这类流可能阻塞共享同一限流器的所有请求。Agent 级别的 max_concurrency 和非流式请求不受影响,v1 不受影响,该问题由 @lche511 报告。

Oct 9
  1. GitHub 安全公告
    Pydantic AI 并发限流模型在流式请求提前结束时会永久占用槽位

    Pydantic AI 的 ConcurrencyLimitedModel 及 limit_model_concurrency 存在并发槽位泄漏问题:流式请求可能在与获取槽位不同的任务上释放槽位,被 anyio.CapacityLimiter 拒绝,导致槽位在请求结束后仍被占用。流提前结束或按默认 debounce_by=0.1 完整消费 stream_text() 都可能触发。若对外暴露受影响的流式接口并在请求间共享长期存活的限流器,客户端反复发起流并断开即可耗尽并发容量,使后续请求无法进行;清理过程还可能抛出 RuntimeError。Agent 级 max_concurrency 和非流式模型请求不受影响。缓解方式是升级到修复版本,或改用 Agent 级 max_concurrency、避免让流式运行经过并发限流模型。

Related discussion

No discussion links have been collected for this event yet.

Attention trend

New sources per day

11 days total2 ·Maximum1(Oct 2)·Today0

  • Oct 2New1 sources (1 outlets,0 accounts)
  • Oct 3New0 sources (0 outlets,0 accounts)
  • Oct 4New0 sources (0 outlets,0 accounts)
  • Oct 5New0 sources (0 outlets,0 accounts)
  • Oct 6New0 sources (0 outlets,0 accounts)
  • Oct 7New0 sources (0 outlets,0 accounts)
  • Oct 8New0 sources (0 outlets,0 accounts)
  • Oct 9New1 sources (1 outlets,0 accounts)
  • Oct 10New0 sources (0 outlets,0 accounts)
  • Oct 11New0 sources (0 outlets,0 accounts)
  • Oct 12New0 sources (0 outlets,0 accounts)

Hourly attention

No comparable trend data