fix: drop aiohttp read timeout of the S3 client

aiohttp 3.13-3.14.5 re-arms sock_read in resume_reading() after a
streamed response has already returned the connection to the pool; the
timer fires while the connection idles and the next call on it fails in
1 ms with ReadTimeoutError (503 on a healthy S3). The call and per-chunk
asyncio.timeout stay the only S3 timeout. Adds driver.py s3-idle and
documents the timeouts in the rules.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-23 01:13:36 +03:00
co-authored by Claude Opus 5.5
parent 4cfaab0063
commit b5983f0e35
9 changed files with 579 additions and 21 deletions
@@ -47,7 +47,7 @@
неизвестный сценарий. Проверка: `make student_test
BASE_URL=http://localhost:8090` — сверка покрытия (`test_coverage.py`)
зелёная, новый сценарий учтён как проверка отказов.
- [ ] 1.6 Красный прогон до правки: `make failure_checks FAULT_ARGS='-k
- [x] 1.6 Красный прогон до правки: `make failure_checks FAULT_ARGS='-k
idle_s3'` три раза подряд на дереве с тестом и без правки 2.1. Каждый —
1 failed: 503 `unavailable` на загрузке после простоя, номер раунда — в
выводе. В журнале API стенда — `put_object` `ReadTimeoutError` за ~1 мс.
@@ -55,7 +55,7 @@
## 2. Правка клиента S3
- [ ] 2.1 `src/infra/s3/client.py`, `_create_client`: `read_timeout=None`
- [x] 2.1 `src/infra/s3/client.py`, `_create_client`: `read_timeout=None`
(design, решение 1). Рядом — комментарий:
- срок чтения aiohttp переживает ответ и портит соединение в пуле
(aiohttp 3.13–3.14.5);
@@ -72,7 +72,7 @@
## 3. Драйвер и evidence механизма
- [ ] 3.1 `driver.py s3-idle` скилла `run-mtusi-messenger` (stdlib,
- [x] 3.1 `driver.py s3-idle` скилла `run-mtusi-messenger` (stdlib,
Python 3.9; design, решение 4):
- проба через `docker exec -i <реплика api> python -` в работающей
реплике стенда, uvloop, если есть;
@@ -133,7 +133,7 @@
## 5. Документы
- [ ] 5.1 `.claude/rules/infra.md`, раздел S3 (design, решение 1):
- [x] 5.1 `.claude/rules/infra.md`, раздел S3 (design, решение 1):
- срок — только `asyncio.timeout` вызова и блока;
- `read_timeout` aiohttp выключен, почему, и запрет включать без новой
пробы;
@@ -142,7 +142,7 @@
Проверка: `grep -n read_timeout .claude/rules/infra.md` — только новая
формулировка.
- [ ] 5.2 `.claude/rules/student-tests.md`: четвёртый API стенда отказов,
- [x] 5.2 `.claude/rules/student-tests.md`: четвёртый API стенда отказов,
`test_upload_after_idle_s3`, красный и зелёный прогоны, время прогона.
AGENTS.md: карта кода (`run_failures.py` — четыре API, `client.py` —
срок только приложения), таблица команд (`s3-idle`), описание `make