# asyncio.queues.QueueFull: 

- **ID:** `python/asyncio-queue-bounded-full`
- **领域:** python
- **类别:** runtime_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

在已达 maxsize 的 asyncio.Queue 上调用 put_nowait()，且没有消费者在消费，导致有界队列拒绝该元素。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 3.8 | active | — | — |
| 3.9 | active | — | — |
| 3.10 | active | — | — |
| 3.11 | active | — | — |
| 3.12 | active | — | — |

## 解决方案

1. **** (92% 成功率)
   ```
   q = asyncio.Queue(maxsize=100)
async def producer():
    for item in items:
        await q.put(item)  # blocks when full, no QueueFull
   ```
2. **** (88% 成功率)
   ```
   consumers = [asyncio.create_task(consume(q)) for _ in range(4)]
await producer(q)
await q.join()
for c in consumers: c.cancel()
   ```

## 无效尝试

- **** — Defers the problem; under sustained producer-heavy load memory still grows unbounded. (75% 失败率)
- **** — Causes data loss with no visibility; downstream counters drift. (80% 失败率)
