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
+14 -3
View File
@@ -3,8 +3,12 @@
Design change `s3-storage`, решения 6–7. Каждый вызов ограничен
`[s3] timeout_seconds` (`asyncio.timeout`), повторов botocore нет
(`total_max_attempts=1`): рестарт S3 повтора не требует, таймаут, как у
Valkey, не повторяется, а загрузку повторяет клиент контракта. Ошибки
переводятся в доменные исключения:
Valkey, не повторяется, а загрузку повторяет клиент контракта. Срок —
только у приложения: `asyncio.timeout` на вызов и на каждый блок
потокового чтения; срок чтения сокета aiohttp выключен (`read_timeout`
None): он переживал ответ и портил соединение в пуле (design change
`fix-upload-put-flake`, решение 1). Ошибки переводятся в доменные
исключения:
- отказ соединения, обрыв, таймаут, 5xx, отказ в учётных данных или в
доступе и отсутствующий bucket — `ObjectStorageUnavailable` (503
@@ -301,7 +305,14 @@ class ObjectStorage:
# виртуальные хосты bucket.s3 Docker DNS не разрешает
s3={"addressing_style": "path"},
connect_timeout=s3.connect_timeout_seconds,
read_timeout=s3.timeout_seconds,
# срока чтения aiohttp нет: в 3.13–3.14.5 после потокового
# ответа больше буфера `resume_reading()` взводит его уже у
# соединения в пуле, через срок он срабатывает и портит
# соединение, и следующий вызов падает за 1 мс
# (`ReadTimeoutError`, 503). Срок вызова и блока чтения —
# `asyncio.timeout` в `_call` и `_read_chunk` (design change
# `fix-upload-put-flake`, решение 1)
read_timeout=None,
# повторов нет: отказ — сразу 503, срок — один на вызов
retries={"total_max_attempts": 1},
max_pool_connections=s3.max_connections,