# asyncio.queues.QueueFull

- **ID:** `python/asyncio-queue-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. **** (95% 成功率)
   ```
   Use await queue.put(item) to apply backpressure:

await queue.put(item)
   ```
2. **** (88% 成功率)
   ```
   Add more consumer tasks to drain faster:

consumers = [asyncio.create_task(worker(queue)) for _ in range(10)]
   ```
3. **** (82% 成功率)
   ```
   For bounded producers, drop-oldest semantics:

if queue.full():
    queue.get_nowait()
queue.put_nowait(item)
   ```

## 无效尝试

- **** — Postpones the error and increases memory pressure; eventually fills again. (70% 失败率)
- **** — Silently drops items, corrupting downstream processing. (85% 失败率)
- **** — Loses async backpressure and blocking semantics; consumers may busy-wait. (75% 失败率)
